Results 1 to 4 of 4
  1. #1
    shuddle is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2016
    Posts
    43

    One Form, Multiple Queries using Toggle or Command Button

    I currently have a form that is controlled by a select query with a criteria. I have a second form identical in all ways except it's select query does not have the criteria (it shows all records).



    What I would like to do is use one form adding a toggle or command button that will toggle between the two different queries.

    Is this even doable??

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    of course it's doable

    the simplest way is to include a button on your all records form which would have something like this in the click event

    Code:
    if me.filter="" then 'apply a filter
        me.filter="somefield=10" 'i.e. the where part of the sql from your other form
        me.filteron=true
    else 'remove the filter
        me.filter=""
        me.filteron=true
    end if
    there are other ways but they will only really have an impact for larger datasets

  3. #3
    shuddle is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2016
    Posts
    43
    It is working except I'm working with a date field and I don't know how to write the syntex.

    I tried = 0 and <> 0 neither gave me the results. How do I write is null for the field?

    Private Sub Toggle464_Click()
    If Me.Filter = "" Then 'apply a filter
    Me.Filter = "Date_Resolve=0" 'i i.e. the where part of the sql from your other form
    Me.FilterOn = True
    Else 'remove the filter
    Me.Filter = ""
    Me.FilterOn = True
    End If
    End Sub

  4. #4
    shuddle is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2016
    Posts
    43
    I got it.. I had misspelled the field. Should be Date_Resolved=0

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

Similar Threads

  1. Replies: 21
    Last Post: 02-08-2019, 11:18 AM
  2. Replies: 2
    Last Post: 03-02-2016, 03:04 PM
  3. Toggle Form between Queries
    By seocavaz in forum Access
    Replies: 7
    Last Post: 06-18-2015, 02:31 PM
  4. Combining multiple toggle button filters
    By jasdem in forum Access
    Replies: 4
    Last Post: 09-18-2013, 10:29 AM
  5. Toggle Button on Bound Form
    By P5C768 in forum Forms
    Replies: 7
    Last Post: 12-30-2010, 03:00 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