Results 1 to 8 of 8
  1. #1
    dada is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    40

    Database Search filter

    Hi! I'm totally new to microsoft access, I'm doing a simple search engine in my form.. that onchange of the textbox value, it will filter the result without pressing any button. anyone can help me with this function? thanks in advance!

    here is the scene of my form: i have a textbox and has the label named title.. below the textbox is a subform/subreport that displays all the values in the table..

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    how do the search results relate to what is entered in the box?

    what do you want to search?

    titles that match exactly?

    where titles in the table are LIKE what is entered?

  3. #3
    dada is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    40
    umm.. i'm actually trying to make a simple search engine about employee's record to be filtered by id. so if the user type the exact id in the textbox, it will show all the result in a subform/subreport. please help..
    Last edited by dada; 08-18-2010 at 03:04 AM.

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    i'm not able to gather what I need from your description. I would take a look at your file if you want to upload it here.

  5. #5
    dada is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    40

    Here:

    here is the file.. run the form DTR.. what i'm trying to do is Afterupdate of the textbox, the subreport/subform will then become visible and will only show the exact barcode typed in the textbox, if the barcode has no match, i will not show any results or will just show a message box that it's invalid.

    here:
    Attachment 1581

  6. #6
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Plz see Form1 here I have a TextBox Text0 and a List box List2. The List2 displays the Records in tblEmployee. In the Rowsource Query of the list Box I have put this criteria in the BarCode Field:

    [Forms]![Form1]![Text0]


    This will ensure that data in the List Box will be displayed that of the particular BarCode entered in Text0. But to do this we need to Requery the list Box which I have done using the code attached in the AfterUpdate event of the Text box. The list Box is visible only when data is found to be displayed other wise u get a msg prompt invalid Barcode and a label is also displayed on the form no data found.

    The code attached is as follows:

    Dim intRecordCount As Integer
    intRecordCount = IIf(IsNull(DCount("[EmployeeId]", "tblEmployee", "[BarCode]='" & Me.Text0 & "'")), 0, DCount("[EmployeeId]", "tblEmployee", "[Barcode]='" & Me.Text0 & "'"))
    If intRecordCount = 0 Then
    Me.Label4.Visible = True
    Me.List2.Visible = False
    MsgBox "Invalid Employee Code"
    Else
    Me.Label4.Visible = False
    Me.List2.Visible = True
    End If
    Me.List2.Requery


    I am attaching the sample please check Form1.

    Note. After entering the barcode in the text box press enter to trigger the afterupdate event code.

  7. #7
    dada is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    40
    awesome!!!!!! you nailed it! thank you so much!!! i have one last question, i'll make use of your time while your online.. hehe... thank you so much sir maximus!

  8. #8
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    No problem mark the thread solved
    Glad to help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Search a Number in Database Field
    By julia_877 in forum Programming
    Replies: 3
    Last Post: 08-06-2010, 01:24 PM
  2. Access search
    By chris in forum Programming
    Replies: 10
    Last Post: 04-19-2010, 11:09 AM
  3. Search 17,000 records
    By dibblejon in forum Forms
    Replies: 1
    Last Post: 02-25-2010, 08:01 AM
  4. How do I create a name search ?
    By nightviperdark in forum Access
    Replies: 1
    Last Post: 11-23-2009, 09:53 AM
  5. Search
    By DWS in forum Forms
    Replies: 3
    Last Post: 08-24-2009, 12:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums