Solved

Toggle Button to Filter Form Data

Posted on 2009-07-15
2
449 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
2 Comments
 
LVL 34

Accepted Solution

by:
jefftwilley earned 500 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now