Help on reports..

A

Anna

Hi,

I am creating a report based on form criteria. And on the form I have few
fields like combo boxes, checkboxes..etc. Now I want the records to appear in
my report which would be the combination of criteria..like

one combobox is: job location
2nd if for: Job staus and others are checkboxes.

Now when I pick my option for job location and for status and for other
check boxes..its giving me records based on the query (where I am using 'and'
under criteria). So it gves me records which meet all these criteria.
say:
job location is: virginia
Job staus: full-time
education (check boxes) say user picks: BA and MS

This is working great. BUt user has to pick all the the options..

Now On the other hand..I want to get a report which has :

only RN degree. Here I don't want to see other employees for job location
status etc..

Because right now the way my wuery is I will get all the virginia
employees+full-time+BA and MS employees PLUS its going to give me RN
employees also. But
I want just the employyess with RN degree

How can I fix my query for this

Please help me..I would appreciate your help.
Thanks in advance
 
D

Duane Hookom

I try to never use dynamic criteria in a report's record source query. I
"build" a where string to use in the DoCmd.OpenReport line.

Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.cboJobLocation) Then
strWhere = strWhere & " And JobLocation = """ & _
Me.cboJobLocation & """ "
End If
If Not IsNull(Me.cboStatus) Then
strWhere = strWhere & " And Status = """ & _
Me.cboStatus & """ "
End If
....
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere
 
Top