-
searching for records
hi,
i have a datagrid and i am trying to search for certain records by means of a combobox. i seem to be going about it all wrong. this is the code i have to date
Private Sub searchid_Click()
Dim selected As String
If searchid.Caption = "Search By Cabinet Id" Then
selected = Combodateselect.Text
Adocosts.Recordset.Filter = "[Cabinet Id] > " & selected
searchid.Caption = "Cancel"
Else
DTservice1.Value = Date
Adocosts.Refresh
dbgservicecosts.Refresh
searchid.Caption = "Search By Cabinet Id"
End If
End Sub
can anyone help me with this thanks
-
-
ya i get an error saying
"Arguments are of wrong type, are out of the acceptable range or are in conflict with each other"
thanks
-
what line are you getting the error on?
-
the line
Adocosts.Recordset.Filter = "[Cabinet Id] > " & selected
-
what is the value of selected ?
-
if your datatype for [cabinet ID] is text, then you should do this:
adodc.recordset.filter=" [cabinet ID]>' " & string & " ' "
if your datatype for [cabinet ID] is number, then you should do this:
adodc.recordset.filter=" [cabinet ID]> " & clng(string)
-
Sorry selected is a string value
i tried that and it worked for me, thanks for your help