PDA

Click to See Complete Forum and Search --> : Searching for records


Ed_Farias
Mar 28th, 2000, 12:37 AM
I am using the below code to search for a particular user or asset tag# in a database. The code works fine, the problem is after I search for the user, my back and forward buttons no longer scroll through database. Any help is appreciated.


If optUser.Value = True Then
Dim UserName As String
UserName = InputBox("Which User would you like to search for?")
datComputers.RecordSource = "select * from Computers " & _
"where UserID = '" & UserName & "'"
datComputers.Refresh
Else
Dim AssetTag2 As String
AssetTag2 = InputBox("Which AssetTag would you like to search for?")
datComputers.RecordSource = "select * from Computers " & _
"where AssetTag = '" & AssetTag2 & "'"
datComputers.Refresh
End If

RogerH
Mar 28th, 2000, 09:02 PM
With the code you provided, you set the RecourdSource (the recordset) the form shows. I assume that the asset# is unique. You the have only one record in your recordset after runnig the code. That's why you scroll buttons wont work anymore.

A possible solution is either using the 'find' method or provide a reset button thet rests the recordsource.

Roger