Results 1 to 15 of 15
  1. #1
    EthanMoist is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2013
    Posts
    14

    Double click on listbox to open up form

    Hi, I am looking for a code to open up a specific form based on listbox data after double clicking on the record.

    The primary key for the listbox is "PerfID"



    Thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,523
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    EthanMoist is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2013
    Posts
    14
    Yes, just like that. The only thing I am not understanding is the last Me.xxxxx. What does the ControlName refer to?

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,523
    The name of the control containing the value to filter on. In your case, the listbox.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    EthanMoist is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2013
    Posts
    14
    Thank you! That worked...only issue now is that when I double click it is defaulting to a new form rather than the requested form.

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,523
    You mean a new record? What is the code to open the form, and what is the data entry property of the form being opened?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    EthanMoist is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2013
    Posts
    14
    Yes, a new record...

    The code to open the form is:

    DoCmd.OpenForm "frm_Master", , , "PerfID = " & Me.SearchResults

    Data entry property of the form being opened is:

    Yes

    When I switch data entry to "no" it asks me for parameters when I double click on the record.

  8. #8
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,523
    What parameters? Is PerfID a field in that form's record source?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    EthanMoist is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2013
    Posts
    14
    I'm not understanding the question...sorry, I'm new with this stuff.

    PerfID refers to the Primary Key of tbl_Main. frm_Master is the form I am trying to open up based on the PerfID field.

  10. #10
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,523
    If you're getting a parameter prompt, Access can't find whatever the prompt is for (it should specify what it's looking for in the prompt). Either the field name is spelled wrong, or it isn't in the second form. Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    EthanMoist is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2013
    Posts
    14
    Here you go. I'm also trying to filter the listbox with the combo boxes on top...Once I figure out one, i'll be able to do the others. Thanks!Account Database.zip

  12. #12
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,523
    Your field is text, so it needs the delimiters as shown on the link.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    EthanMoist is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2013
    Posts
    14
    Okay, thanks! The open now works, however the Custodian ID is coming up blank. When I try to switch it manually, it populates as a number on the listbox...

    [ATTACH]12437[/ATTACH
    Attached Files Attached Files

  14. #14
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,523
    Check the bound column property of the combo.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    EthanMoist is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2013
    Posts
    14
    I set it to 1 and now it works. Why did that make the difference?

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

Similar Threads

  1. On Double Click Open Form with two criteria
    By AndreasPanayiotou in forum Programming
    Replies: 3
    Last Post: 09-10-2012, 08:47 AM
  2. double click to open
    By spleewars in forum Programming
    Replies: 7
    Last Post: 05-22-2012, 11:52 AM
  3. Replies: 10
    Last Post: 02-20-2012, 11:25 AM
  4. How to Restrict the Listbox on double click
    By ganeshvenkatram in forum Access
    Replies: 2
    Last Post: 07-07-2011, 10:05 PM
  5. Rescrolling in ListBox on Double Click
    By jackkent in forum Access
    Replies: 6
    Last Post: 09-28-2010, 11:56 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