accepting input from 2 check boxes

helloworld

Registered User.
Local time
Today, 13:26
Joined
May 18, 2004
Messages
62
Hi there,

I am having a lot of trouble with checkboxes. I have a form that will generate a report based on whatever the user selects out of a combobox (this works). However, the user can also select 5 checkboxes that will either select all the records or one of the records or two of the records etc.

For example:

All[] Pepperoni[] Mushrooms[] Onions[] Cheese[]

The user could select All toppings or Mushrooms or Mushrooms and Onions etc. and then click a button where a report generates based on the toppings selected.

In my report query, there is a field (toppings) that list the toppings for each pizza. There is only one topping in each entry.

Can someone please help me do this?
 
what i got so far

this is what I got so far. however this only works when I click one box at a time, not multiples. Your help would be much appreciated

Private Sub gen_report_Click()
On Error GoTo Err_gen_report_Click

Dim stDocName As String
Dim criteria As String


If Forms!SubmissionReport![Check59] = True Then
criteria = "pepperoni"
End If

If Forms!SubmissionReport![Check52] = True Then
criteria = "*" ' Selects all the toppings
End If

If Forms!SubmissionReport![Check55] = True Then
criteria = "ham"
End If

If Forms!SubmissionReport![Check57] = True Then
criteria = "Cheese"
End If

If Forms!SubmissionReport![Check61] = True Then
criteria = "Onion"
End If

stDocName = Forms!SubmissionReport![Combo50] ' select a report from the combo-box

DoCmd.OpenReport stDocName, acPreview, , "[Toppings] like '" & criteria & "'"


Exit_gen_report_Click:
Exit Sub

Err_gen_report_Click:
MsgBox Err.Description
Resume Exit_gen_report_Click

End Sub
 

Users who are viewing this thread

Back
Top Bottom