Conrado Natac
New Member
'this is the error code'
rs.Open "SELECT Distinct [Inv #], [Cust #], [Date],[Due Date], [Amount] as InvBal FROM [data$] WHERE [data$].[Cust #]=" & "'" & cmbcustno.Text & "'" _
& "group by [data$].[Apply to]", acnn, adOpenKeyset, adLockOptimistic
'this is the connection
Option Explicit
Public cnn As New ADODB.Connection
Public rs As New ADODB.Recordset
Public strSQL As String
Public Sub OpenDB()
If cnn.State = adStateOpen Then cnn.Close
cnn.ConnectionString = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" & _
ThisWorkbook.Path & Application.PathSeparator & ThisWorkbook.Name
cnn.Open
End Sub
Public Sub closeRS()
If rs.State = adStateOpen Then rs.Close
rs.CursorLocation = adUseClient
End Sub
rs.Open "SELECT Distinct [Inv #], [Cust #], [Date],[Due Date], [Amount] as InvBal FROM [data$] WHERE [data$].[Cust #]=" & "'" & cmbcustno.Text & "'" _
& "group by [data$].[Apply to]", acnn, adOpenKeyset, adLockOptimistic
'this is the connection
Option Explicit
Public cnn As New ADODB.Connection
Public rs As New ADODB.Recordset
Public strSQL As String
Public Sub OpenDB()
If cnn.State = adStateOpen Then cnn.Close
cnn.ConnectionString = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" & _
ThisWorkbook.Path & Application.PathSeparator & ThisWorkbook.Name
cnn.Open
End Sub
Public Sub closeRS()
If rs.State = adStateOpen Then rs.Close
rs.CursorLocation = adUseClient
End Sub