I have a table with over 4000 records to search upon, and the users
don't like a combo box.
So what I have been trying to do for the last twelve hours is do some
code to get a text box to search. I am learning fast, but I really
don't know how to do it, and would appreciate some help.
So far I have got to this:
Private Sub btnSearch_Click ()
Dim strFindLocation As String
Dim strSearch As String
Dim intAsset number As Integer
Dim lngsngkm as Long
'Has the user entered anything?.
If IsNull(Me![txtsearch]) Or (Me![txtsearch]) = "" Then
MsgBox "Please enter a value to search on, eg, location",
vbOKOnly, "Put text in the box!"
Me![txtsearch].SetFocus
Exit Sub
'Performs the search based upon the input into txtSearch
Set strSearch = (Me![txtsearch])
If Not IsNull(Me![txtsearch]) Then
(THIS IS WHERE I AM STUCK)
'select records like txtSearch from
'location name in location table
((CANNOT FIGURE OUT AN SQL WHICH WORKS
'and put them into a subform for the user to
'select the correct one (include intAssetNumber and sngkm in
subform)
CANNOT GET THE RESULTING RECORDS TO RUN AS A QUERY INTO ANOTHER FORM
'correct location = strFindLocation , correct asset number =
intAssNum
'correct km = lngSngKm
'from strFindLocation then find Asset Number and km location
'and populate new job details form
Any help greatly appreciated.
End If
End Sub
don't like a combo box.
So what I have been trying to do for the last twelve hours is do some
code to get a text box to search. I am learning fast, but I really
don't know how to do it, and would appreciate some help.
So far I have got to this:
Private Sub btnSearch_Click ()
Dim strFindLocation As String
Dim strSearch As String
Dim intAsset number As Integer
Dim lngsngkm as Long
'Has the user entered anything?.
If IsNull(Me![txtsearch]) Or (Me![txtsearch]) = "" Then
MsgBox "Please enter a value to search on, eg, location",
vbOKOnly, "Put text in the box!"
Me![txtsearch].SetFocus
Exit Sub
'Performs the search based upon the input into txtSearch
Set strSearch = (Me![txtsearch])
If Not IsNull(Me![txtsearch]) Then
(THIS IS WHERE I AM STUCK)
'select records like txtSearch from
'location name in location table
((CANNOT FIGURE OUT AN SQL WHICH WORKS
'and put them into a subform for the user to
'select the correct one (include intAssetNumber and sngkm in
subform)
CANNOT GET THE RESULTING RECORDS TO RUN AS A QUERY INTO ANOTHER FORM
'correct location = strFindLocation , correct asset number =
intAssNum
'correct km = lngSngKm
'from strFindLocation then find Asset Number and km location
'and populate new job details form
Any help greatly appreciated.
End If
End Sub
Comment