hello,
i am trying to populate a listbox with an sqlstring while at the same time using a recordset (using same sqlstring) to tally-up values from a particular field.
as of right now, the listbox populates w/o error, but when i [try to] initialize my recordset, nothing happens (except eof=true)
it seems that anytime i use string/text for my search condition, recordcount is 0 (even though my listbox displays proper output). if i use numeric data for search, the recordset initializes properly and i get no errors.
if anyone has any suggestions with this that would be great.
here is a sample of my code:
Dim rs As New ADODB.Recordset
dim strSQL as string
strSQL = "SELECT * FROM Clients WHERE Notes Like " & Chr(34) & "something" & Chr(34)
lstBox.RowSource = strSQL
rs.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If Not rs.EOF Then
msgbox rs.RecordCount
End If
rs.Close
Set rs = Nothing
Thanks,
DC
i am trying to populate a listbox with an sqlstring while at the same time using a recordset (using same sqlstring) to tally-up values from a particular field.
as of right now, the listbox populates w/o error, but when i [try to] initialize my recordset, nothing happens (except eof=true)
it seems that anytime i use string/text for my search condition, recordcount is 0 (even though my listbox displays proper output). if i use numeric data for search, the recordset initializes properly and i get no errors.
if anyone has any suggestions with this that would be great.
here is a sample of my code:
Dim rs As New ADODB.Recordset
dim strSQL as string
strSQL = "SELECT * FROM Clients WHERE Notes Like " & Chr(34) & "something" & Chr(34)
lstBox.RowSource = strSQL
rs.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If Not rs.EOF Then
msgbox rs.RecordCount
End If
rs.Close
Set rs = Nothing
Thanks,
DC