Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Base report on criteria selected

Status
Not open for further replies.

jmhicsupt

MIS
Oct 22, 2005
49
US
I have a report that I need the user to be able to set the criteria. Currently I am renaming the query and building separate reports. There's got to be a better way!

For instance, I want to have a form that would have the below are checkboxes -- and only ONE checkbox can be chosen:
[ckCustomerInactive] (if checked, give me the True)
[ckCustomerInactive] (this is the same field as the above, but I want to list it again but label it "Active Customers" and if checked, give me the False)
[ckCustomerTerm] (if checked, give me the True)

And if no check boxes are chosen, give me ALL records.

Thanks in advance.


 
I recommend using the Where clause in the DoCmd.OpenReport method.
Code:
Dim strWhere as String
If Me.ckCustomerInactive = True Then
   strWhere = "[Status]='InActive'"
 Else
   strWhere = "[Status]='Active'"
End If
If Not IsNull(Me.txtStartDate) Then
   strWhere = strWhere & " AND [DateField]>=#" & me.txtStartDate & "# "
End If
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top