Results 1 to 3 of 3
  1. #1
    dweekley is offline Advanced Beginner
    Windows XP Access 2002 (version 10.0)
    Join Date
    May 2010
    Posts
    52

    Using search form with listbox to goto record

    I have created a search form with a listbox based on a query. The search form is working as planned. Having trouble locating how to pass the record ID in the listbox from the search form to my main form. The listbox has the record ID in it, but the column width is at '0' so it doesn't display. I am thinking the docmd.gotorecord is wrong. Also my main form was looking at the table, but I figured a query was probably the better way to go.

    TIA

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You need an event to happen in order to pass the ID to the main form. What is the sequence of events, is the main form already open or are you opening it after the search? If you are opening the form, use the "WHERE" part of the openform command to set the criteria ("ID=" & listbox value). If the form is already open, then set its filter:
    Forms("YourFom").Filter = "ID=" & listbox value
    Forms("YourForm").FilterOn = True

  3. #3
    dweekley is offline Advanced Beginner
    Windows XP Access 2002 (version 10.0)
    Join Date
    May 2010
    Posts
    52
    Ah...one of these days I'll get the [] and ! figured out. Thank you much.

    Should I be concerned with clearing the filter? The main form opens to a new record so I am thinking no?

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

Similar Threads

  1. Replies: 2
    Last Post: 02-22-2017, 05:45 AM
  2. Replies: 1
    Last Post: 06-09-2012, 05:44 PM
  3. Replies: 13
    Last Post: 01-29-2012, 01:45 PM
  4. Unable to search record in my listbox
    By mar_t in forum Access
    Replies: 7
    Last Post: 07-27-2011, 07:37 PM
  5. Replies: 1
    Last Post: 06-01-2011, 06:44 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