Filtering Records by checkboxes

  • Thread starter Thread starter G Sandoval via AccessMonster.com
  • Start date Start date
G

G Sandoval via AccessMonster.com

I want to filter all my records based on the criteria if a checkbox is
selected. I have a checkbox on the form for every day of the week. When
they run the program i will prompt them to select what day it is. Say they
select the monday button i only want the records that have the monday
checkbox selected to be displayed. Is this possible.. is there an easier
way to do this?

Gabriel
 
Gabriel, there is an easy way to do this. You will make 7 command buttons on
your form, one for each day of the week. Behind each button on the "on
click" even you want to invoke a macro. Each macro has an ApplyFilter
command with the condition being something like Day=1, or Day=2, whatever the
field name is for your days (if this is stored from a drop down list). The
ApplyFilter command will do the trick. Feel free to send the database to me
directly and I'll check your work or modify it.

Destin Richter
(e-mail address removed)
 
Thanks alot Destin. I think I get what you are saying. Ill give that a
shot and get back to you if I run into any problems.
Thanks again.
~~gabriel
 
Hello,
instead of using check box you can apply filter using radio button group.
1. create a group with radio buttons each one for each day of week.
2. create two command buttons with name show selected day and show all.
3. To be able to get all records click event of show all button code is
private sub Command_showall_click()
forms!myform.form.filteron=false
end sub
4. to apply filter for selected day
private sub command_showselected_click()
dim mycritearia as string
if radiogroup=1 then mycriteria="Sunday"
if radiogroup=2 then mycriteria="Monday"
if radiogroup=3 then mycriteria="Tuesday"
if radiogroup=4 then mycriteria="Wednesday"
if radiogroup=5 then mycriteria="Thursday"
if radiogroup=6 then mycriteria="Friday"
if radiogroup=7 then mycriteria="Saturday"
Forms!myform.form.filter="[myfield] like mycriteria"
forms!myform.form.filteron=true
end sub

you can do it only one radio group and two command buttons..

I hope this will help you.....
 
Back
Top