Results 1 to 6 of 6
  1. #1
    markcrobinson is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Location
    New Hampshire, US
    Posts
    31

    Search -> Select -> Display


    I have a form with Customer information and a subform with all their invoices.
    I put a search text box on top of the form and a search Button
    The search button executes a query
    Like "*" & [Forms]![CustomerDisplay]![Search] & "*"
    That displays all the records the user might be looking for.
    I want the user to select the correct name, have that name fill the top of the form so the subform will display his invoices.

    How does the user "select" the correct name for the list?
    How do I get this info back into the form?

    Thank you!

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,122
    Many ways to do that... Use the query to populate a list box, combobox or subform placed in the header of your mani form, then use the AfterUpdate event of whatever control you decide to go with to requery the main form (which has a recordsource refering to that combo , listbox or subform - Select Customer.* FROM Customer Where CustomerID= FOrms!frmMainForm.lstListboxFiltered).

    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    markcrobinson is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Location
    New Hampshire, US
    Posts
    31
    Thank you.
    Use the query to populate a list box
    So my button calls the query with the "like" criteria and the query shows up. I click on the record I want -- then how do I refer to that record? I think you're suggesting a Recordsource referring...
    What would be an excample of a recordsource referring to that query current record?

    I do understand how to use a combox box for a search, but the combo box does not easily accommodate a "like" search. Currently, I put the "Like" criteria is
    [CustomerDisplay]![Search], then have to run the combox box -- maybe that's the best way...



  4. #4
    markcrobinson is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Location
    New Hampshire, US
    Posts
    31
    Nevermind (in the voice of Emily Natella)
    Got it.

    Quote Originally Posted by markcrobinson View Post
    I have a form with Customer information and a subform with all their invoices.
    I put a search text box on top of the form and a search Button
    The search button executes a query
    Like "*" & [Forms]![CustomerDisplay]![Search] & "*"
    That displays all the records the user might be looking for.
    I want the user to select the correct name, have that name fill the top of the form so the subform will display his invoices.

    How does the user "select" the correct name for the list?
    How do I get this info back into the form?

    Thank you!

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,122
    Glad to hear you got it working, the "like" query is the row source of the listbox then the main form is filtered by the selection in the listbox.

    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by markcrobinson View Post
    The search button executes a query
    Like "*" & [Forms]![CustomerDisplay]![Search] & "*"
    Be aware that "Search" is a reserved word in Access and shouldn't be used for object names.
    Since you are referencing a text box control, maybe change the name of the control to "tbSearch" (tb - text box) or "txtSearch".

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

Similar Threads

  1. display case select in query
    By HS_1 in forum Programming
    Replies: 8
    Last Post: 08-26-2019, 10:28 PM
  2. How to display a Select query from a macro
    By Middlemarch in forum Programming
    Replies: 5
    Last Post: 07-18-2016, 05:23 PM
  3. Select a record and display an image
    By Chris G in forum Forms
    Replies: 5
    Last Post: 11-01-2012, 04:38 PM
  4. Select a field in a row and display data
    By Darkladymelz in forum Reports
    Replies: 15
    Last Post: 03-13-2012, 03:39 PM
  5. Replies: 4
    Last Post: 03-17-2011, 06:17 AM

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