Hello, I'm using an option box here to find by d800no, company and pstnno fields but I'm getting 'run time error 424 object required'. What code is missing in my script below.
Code:
Dim Category As String
Dim OptionNumber As Integer
Dim SelItem As Integer
Dim SearchStr As String
Private Sub RunSearch()
Select Case OptionNumber
Case 0
Category = "D800no"
Case 1
Category = "Pstnno"
Case 2
Category = "Company"
End Select
If OptionNumber = 1 Then
Adodc1.RecordSource = "Select D800no, Company, Pstnno From dtfs_2005 Where " & Category & " like '*" & txtSearchStr.Text & "*'"
Else
Adodc1.RecordSource = "Select D800no, Company, Pstnno From dtfs_2005 Where " & Category & " like '*" & txtSearchStr.Text & "*'"
End If
Adodc1.Refresh
End Sub
Private Sub OPts_Click(Index As Integer)
OptionNumber = Index
End Sub
Private Sub Cmd_Find1_Click()
If Trim(txtSearchStr.Text) = "" Then Exit Sub
RunSearch
End Sub
Comment