Results 1 to 5 of 5
  1. #1
    AlanJKiwi is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Location
    NZ
    Posts
    3

    One Form, different queries

    Hi,
    I currently have 3 identical versions of a form (showing application data).

    These forms each get their data from 3 separate queries.



    One that shows all data from two tables.
    One that shows the above but filtered by year.
    One that shows the above but also filtered to show only approved applications.

    I feel there must be an easier way then having 3 separate forms.

    Is there a way to just have 1 form, that links to one of the 3 queries depending on what button the user selects to open the form?

    Any help would be most appreciated.
    AJ

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Sure.

    Using the form that displays all records, you could add a text box for the year (if you want to be able to change the year), some way option group (for approved or all) and 2 buttons.

    One button has code to remove the filter.
    The other button has code in the click event to create a filter string "on the fly".
    The code checks to see if there is a year entered and/or if only approved records should be returned.

    It would look something like this : http://allenbrowne.com/ser-62code.html

  3. #3
    trevor40's Avatar
    trevor40 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    407
    yes, use 3 buttons each with thier own vba for the onclick event

    button_1_OnClick()
    me.recordsource = "your query name"
    me.refresh
    end sub

  4. #4
    AlanJKiwi is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Location
    NZ
    Posts
    3
    Hi Steve,
    thanks for the quick reply and the info.
    A bit beyond my abilities at the mo. But i'll see if i can make it work just for my own education.
    AJ

  5. #5
    AlanJKiwi is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Location
    NZ
    Posts
    3
    Cool, thanks Trevor.
    That did the trick.
    AJ

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

Similar Threads

  1. Replies: 9
    Last Post: 08-27-2014, 11:34 AM
  2. Replies: 8
    Last Post: 01-30-2014, 05:26 PM
  3. One Form, Two Queries?
    By uncletreetrunk in forum Queries
    Replies: 13
    Last Post: 07-02-2012, 04:20 PM
  4. multiple queries in form
    By geraldk in forum Forms
    Replies: 5
    Last Post: 12-26-2011, 02:22 PM
  5. form with different queries
    By bbeernaert in forum Queries
    Replies: 2
    Last Post: 08-26-2010, 03:11 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