Results 1 to 2 of 2

Thread: Searching for records

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Tucson, AZ, USA
    Posts
    95
    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

  2. #2
    Lively Member
    Join Date
    Dec 1999
    Location
    Karlsruhe, Germany
    Posts
    122
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width