Results 1 to 6 of 6
  1. #1
    Join Date
    May 2004
    Posts
    14

    Unanswered: Searching an Access DB

    ok here is the situation. I have a form that scrolls through a lot of records...about 1400 give or take. I basically a small section at the top of the form to be a text box where i can enter in text and search for a match in one of the fields (the asset tag) field on my table. What is the best way to accomplish this?

  2. #2
    Join Date
    Feb 2004
    Location
    Wales
    Posts
    343
    I think we need a little more information about what the target field actually contains just to say seach for text really isnt enough

    How much text does each record hold

    is it alpha-text

    a bit more will help


    gareth

  3. #3
    Join Date
    Mar 2004
    Location
    INDIA
    Posts
    10

    Same Problem

    Man if you are able to solve your problem then please help me also

  4. #4
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Open table in datasheet view, click records > filter by record. The table will clear with one record, all blank. fill in what you want/need then hit apply filter, there you go. Then hit close filter when you are done, and your full table will popup.

  5. #5
    Join Date
    Oct 2003
    Location
    US
    Posts
    343
    If you don't want to do the filter by forms then you can do it using vba. Try searching for "findfirst" or "search" in the help, you'll get alot of examples that'll do it.

  6. #6
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Quote Originally Posted by chrissanders
    ok here is the situation. I have a form that scrolls through a lot of records...about 1400 give or take. I basically a small section at the top of the form to be a text box where i can enter in text and search for a match in one of the fields (the asset tag) field on my table. What is the best way to accomplish this?
    Hi chrissanders,

    What I use is what is called a DialogBox. Create a UnboundForm from scratch, place a control on your form (TextField...) or what ever you wish to search on. Create a button and call it like GetData or something and another one to clear out your entry called something like Reset. Now, the trick to make it all work is in the code behind the CommandButton.
    In the GetData command button OnClick event supply your code like:

    Code:
    Private Sub cmbJobChargesRpt_Click()
    On Error GoTo Err_cmbJobChargesRpt_Click
    'This code pulls out only records that match the JobID number input in the
    'text box created on the DialogForm.
    
        Dim stDocName As String
        Dim stLinkCriteria As String
        
        stDocName = "rptJobChargesByJob2"
        
        stLinkCriteria = "[JobID]= " & " '" & Me![JobID] & "'"
        DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria
        DoCmd.Close acForm, "frmJobChargeByJobDiag"
        
    Exit_cmbJobChargesRpt_Click:
        Exit Sub
    
    Err_cmbJobChargesRpt_Click:
        Select Case Err.Number
    Case 2501 'Empty report
        Resume Exit_cmbJobChargesRpt_Click
    Case Else
        MsgBox Err.Description
        Resume Exit_cmbJobChargesRpt_Click
    End Select
    
    End Sub
    Now to reset it so clear it out for another entry do this:
    Code:
    Private Sub Reset_Click()
    
       [JobID] = ""
    
    End Sub
    This came out of my database and use it to filter out Only certain JobID numbers that I need. It then pulls up the Report I need, but the same works for a Form also. Give it a whirl.

    hope this helps,
    Bud

Posting Permissions

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