Solved

Toggle Button to Filter Form Data

Posted on 2009-07-15
2
448 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

758 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

20 Experts available now in Live!

Get 1:1 Help Now