Dear Friends,
SQL query is working with Multi Colum list Rowsource, but not with the ADO Recordset. SELECT without where work fine.
I have used Select with 'WHERE' several times but this is the first instance of the problem.
Can you guys help me out?
.......................
Private Sub LstAddressController_Click()
On Error Resume Next
MsgBox LstAddressController.Column(0) & "-" & LstAddressController.Column(1)
Dim m As String
m = "Select PointType, ObjectName, ExpandedID from HrdSch where Address like '" & LstAddressController.Column(0) & "*' And Controller Like '" & LstAddressController.Column(1) & "*';"
MsgBox m
ControllersDetails.RowSource = m
ControllersDetails.Requery
ControllersDetails.SizeToFit
m = "Select distinct Panel from HrdSch where Address like '" & LstAddressController.Column(0) & "*' And Controller Like '" & LstAddressController.Column(1) & "*';"
PanelName1.RowSource = m
PanelName1.Requery
'.......Test Recordset Select with 'WHERE' query
Dim rst1 As ADODB.Recordset
Set rst1 = New ADODB.Recordset
rst1.CursorLocation = adUseClient
rst1.Open m, CurrentProject.Connection
MsgBox rst1.RecordCount
rst1.Close
Set rst1 = Nothing
End Sub
SQL query is working with Multi Colum list Rowsource, but not with the ADO Recordset. SELECT without where work fine.
I have used Select with 'WHERE' several times but this is the first instance of the problem.
Can you guys help me out?
.......................
Private Sub LstAddressController_Click()
On Error Resume Next
MsgBox LstAddressController.Column(0) & "-" & LstAddressController.Column(1)
Dim m As String
m = "Select PointType, ObjectName, ExpandedID from HrdSch where Address like '" & LstAddressController.Column(0) & "*' And Controller Like '" & LstAddressController.Column(1) & "*';"
MsgBox m
ControllersDetails.RowSource = m
ControllersDetails.Requery
ControllersDetails.SizeToFit
m = "Select distinct Panel from HrdSch where Address like '" & LstAddressController.Column(0) & "*' And Controller Like '" & LstAddressController.Column(1) & "*';"
PanelName1.RowSource = m
PanelName1.Requery
'.......Test Recordset Select with 'WHERE' query
Dim rst1 As ADODB.Recordset
Set rst1 = New ADODB.Recordset
rst1.CursorLocation = adUseClient
rst1.Open m, CurrentProject.Connection
MsgBox rst1.RecordCount
rst1.Close
Set rst1 = Nothing
End Sub