Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Toggle Button to Filter Form Data

Posted on 2009-07-15
2
Medium Priority
?
503 Views
Last Modified: 2013-11-28
I have a continuous form with the record source SELECT * FROM forFrmProjects
(forFrmProjects is a query based on lots of tables)

The query contains the following fields which I would like to use to filter the data:
1. Current - which may contain the text 'Progressing', 'Old' or 'New'
2. Reported - which is a Yes/No field
3. Allocated - which is a Yes/No field

I would like to have 3 toggle buttons on the Form called:

1. cmdToggleCurrent - which should filter the data to show records where the field Current=Progressing or all of the records
2. cmdToggleReported - which should filter the data to show records where the field Reported=Yes or all of the records
3. cmdToggleAllocated - which should filter the data to show records where the field Allocated=Yes or all the the records

0
Comment
Question by:Ludique
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

Accepted Solution

by:
jefftwilley earned 2000 total points
ID: 24860756
Let's say your form is based on QueryX

Since you can only have 1 recordsource for a form, I would suggest that you use an Option group vs Toggle buttons.

You can set up 4 radio buttons in your option group. 1 for ALL, 2 for Current, 3 for Reported and 4 for Allocated.

Then using the After_Update event of the Option Group, use a case statement to set the recordsource for the form


sub OptionX_AfterUpdate()
dim sSQL as string

Select Cast OptionX
     Case 1
          sSQL = "Select * from QueryX Where Current = 'Progressing'"
          me.RecordSource = sSQL
Case 2
etc..

End Select

End Sub

J
0
 

Author Closing Comment

by:Ludique
ID: 31603778
thank you :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question