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
Solved

Toggle Button to Filter Form Data

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

829 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