Results 1 to 3 of 3
  1. #1
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486

    Dynamically open form based on separate saved queries

    Is there a way to open the same form but with different underlying queries?



    I have two buttons on different forms that I want to use to open a form with data that matches a certain ID. However, the query that is saved with the form name so while it works for button 1 when i try to open it with button 2 , on the other form, the form name for the query criteria is different and of course it doesn't find the ID.

    Is there any way to say something like

    If opened with button 1 Then use query 1, if opened with button 2 user query 2?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    An alternative to using different queries with criteria:

    http://www.baldyweb.com/wherecondition.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    This is why I don't use dynamic parameterized query. I prefer to use WHERE CONDITION argument of OpenForm.

    And now I see Paul has provided a link explaining that.
    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. VBA code to open a file with a dynamically changing filename
    By orangeman2003 in forum Programming
    Replies: 1
    Last Post: 09-09-2014, 06:17 PM
  2. Replies: 5
    Last Post: 07-18-2014, 02:04 AM
  3. Replies: 4
    Last Post: 04-18-2014, 06:14 AM
  4. Replies: 4
    Last Post: 02-03-2013, 11:51 AM
  5. Replies: 1
    Last Post: 07-02-2010, 03:55 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