Results 1 to 4 of 4
  1. #1
    gaby58 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    19

    Search Button in a Form

    Hi All,



    I have 3 fields in a form which is coming from a table, I want add a text box and then a search button, when they enter the value of the first field in the text box and click search all the related data should be displayed in those 3 fields, how do I do that.

    I did use Seach button and a macro, but didn't work, it is kinda urgent so any help is appreciated.

    Thank You

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Make a continous form of your data table.
    put the search box and button in the header.
    when user types in the text box , it will filter the results.

    (since I dont know what field you are searching in, i set it to CITY)

    paste the code below into the BUTTON CLICK event:


    Code:
    sub btnFind_CLICK()
    If IsNull(txtBox) Then
      Me.FilterOn = False
    Else
      Me.Filter = "[City]='" & txtBox & "'"
      Me.FilterOn = True
    End If
    END SUB

  3. #3
    gaby58 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    19
    Is it not possible to get it directly from a table or a query to populate these values?

    Thank You for the info though

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    For more info, review http://allenbrowne.com/ser-62.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 1
    Last Post: 11-30-2016, 03:41 AM
  2. Search Box with Button on Form
    By guillermoftw in forum Access
    Replies: 2
    Last Post: 05-02-2016, 02:51 PM
  3. Replies: 5
    Last Post: 07-13-2012, 01:15 AM
  4. Replies: 12
    Last Post: 03-22-2012, 02:48 AM
  5. Search Button in a Form
    By spideynok in forum Forms
    Replies: 14
    Last Post: 03-18-2012, 10:08 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