Results 1 to 5 of 5
  1. #1
    Madmartigan is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jun 2013
    Posts
    36

    Update A Single Subform Using Command Buttons and Multiple Queries

    Hello all,

    I have searched and searched but haven't been able to find a complete solution to my problem.

    I have 5 unique queries and what I would like to do is create 1 form that has 5 buttons (1 per query). This form will also have a subform (datasheet). When a user presses any one of the 5 buttons, the subform/datasheet will populate with the respective query results. My VBA/SQL skill is still very new so if I can accomplish this via macros, that would be preferred.



    Any help is greatly appreciated.

  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,530
    Me!SubformName.Form.RecordSource = "QueryName"

    replacing SubformName with the name of the subform control name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Sorry, that's VBA. If you want to use a macro, it's either SetValue or SetProperty.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Create 5 forms based on the 5 queries.
    Add 5 sub-form controls on the form. Set each of the sub-form controls visible property to FALSE.

    I never use macros so you will have to create the macros... each button should change the associated sub-form visible property to TRUE and set the other 4 sub-form controls visible property to FALSE.


    Button 1 : Sets
    Sub-form 1 visible property to TRUE
    Sub-form 2 visible property to FALSE
    Sub-form 3 visible property to FALSE
    Sub-form 4 visible property to FALSE
    Sub-form 5 visible property to FALSE

    Button 2 : Sets
    Sub-form 1 visible property to FALSE
    Sub-form 2 visible property to TRUE
    Sub-form 3 visible property to FALSE
    Sub-form 4 visible property to FALSE
    Sub-form 5 visible property to FALSE

    Button 3 : Sets
    Sub-form 1 visible property to FALSE
    Sub-form 2 visible property to FALSE
    Sub-form 3 visible property to TRUE
    Sub-form 4 visible property to FALSE
    Sub-form 5 visible property to FALSE

    ... you get the idea

    The subforms are always populated, you just control which subform you want to see.

  5. #5
    Madmartigan is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jun 2013
    Posts
    36
    Thanks guys! I'll give that a shot!

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

Similar Threads

  1. Replies: 4
    Last Post: 06-10-2012, 02:29 PM
  2. Replies: 7
    Last Post: 08-05-2011, 10:59 AM
  3. Combining 3 update queries for a single table
    By Grahamiwa in forum Queries
    Replies: 1
    Last Post: 05-13-2011, 02:35 PM
  4. Replies: 13
    Last Post: 02-23-2011, 08:38 AM
  5. Multiple UPDATE in single query
    By nishezaman in forum Access
    Replies: 0
    Last Post: 12-13-2009, 01:40 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