Need help with query using check boxes and combo boxes

govuser1

Registered User.
Local time
Today, 02:33
Joined
May 14, 2012
Messages
11
I would like to create a query that uses 3 check boxes and 2 Option groups to filter the data.

I am not sure what code to use. I have got the 3 check boxes working but i can not figure out how to add the option groups to the same query.

3 Check boxes
Data1 (yes/no field)
Data2 (yes/no field)
Data3 (yes/no field)

Option group 1
Employee type 1 (yes/no field)
Employee type 2 (yes/no field)
ALL

Option group 2
Location 1 (data stored as text (location name))
Location 2 (data stored as text (location name))
ALL

Any help would be appreciated i have been googling this and can not figure out how to merge the example i have found.
 
Okay, your description is quiet vauge.. So I am not able to give you an exact Query. But remember that...

* CheckBoxes return the value -1 for Yes and 0 for No.

* OptionGroups return values based on the value you have set.. It might be 0,1,2,3... Any number..

If you still require help, please give some sample data.. and your exact need, either me or someone here will most defenitely answer that.
 
Hmm ok i thought it was very specific. Just shows my limited knowledge i guess

Here is the WHERE statement i am using for the 3 check boxes.

WHERE (((IIf(forms!Report_Menu!Data1,[Data1]=True,True))=True) And ((IIf(forms!Report_Menu!Data2,[Data2]=True,True))=True) And ((IIf(forms!Report_Menu!Data3,[Data3]=True,True))=True));

I don't know if this is the best way to write it but it works to filter my query the way i want so far.

now i want to add to that 2 seperate radio button option groups as additional filters to the query.

the idea is the user is records based on who has data1,2 or 3 then additionally filtering by employee type and also location with the option to select all in either of the categories.

optemployee
emp1
emp2
all_employees

optlocation
location1
location2
all_locations

I am initiating query with a single button onclick event.
 
So you are using VBA to gather the data and then use it in a Query and execute that query using DoCmd or SQL is that correct?
 
Private Sub Command131_Click()
On Error GoTo Err_Command131_Click
Dim stDocName As String
stDocName = "TRAVEL"
DoCmd.OpenReport stDocName, acPreview, "TRAVEL"

Exit_Command131_Click:
Exit Sub
Err_Command131_Click:
MsgBox Err.Description
Resume Exit_Command131_Click

I am using this code for my command button to open a report based on my query.
 

Users who are viewing this thread

Back
Top Bottom