Question : Report based on Multiple Check boxes

I need to create a report of people with various medical conditions. Lets say blind; deaf; cardiac condition; lung condition are in my list. I have a form with true/false checkbox fields corresponding to each condition. I would like to build a report based on the checkboxes on that form so if I only check blind I will get a report of people with only the blind box checked. If someone has blind and deaf checked they should come up if I check blind or check deaf or check blind and deaf. Likewise with the other conditions.

I am have a hard time writing the query to base this report. What is the right way to do this?

Thank you in advance for your help.
Bob

Answer : Report based on Multiple Check boxes

You would be much better off building a query that would return all records, then including a Where condition when opening your Report (assuming you're using DoCmd.OpenReport to open your report). To do that, you'd have to look at all the Checkboxes on your form and build your Where clause:

Dim sFilter As String

If Nz(Me.ckBlind,False) = True Then
  sFilter = "Blind=True"
End If

If Nz(Me.ckDeaf, False) = True Then
  If Len(sFilter) > 0 then sFilter = sFilter & " AND "
  sFilter = sFilter & "Deaf=True"
End If

and so on ...

Now, use sFilter when opening your Report:

DoCmd.OpenReport "YourReportName", acViewPreview, , sFilter

Random Solutions  
 
programming4us programming4us