Solved

Toggle Button to Filter Form Data

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

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.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

626 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