use form to enter report criteria

  • Thread starter Thread starter Mary
  • Start date Start date
M

Mary

I'm using a form to enter report criteria with a combo box
for badge and date. Is there a way to leave the badge
blank if I don't want to reduce the number of records by
the badge criteria for that particular view of the
report? Thanks.

Mary
 
Assuming your report is based on a query that references this form, modify
the WHERE clause

WHERE Badge = Forms!YourForm!cboBadge or Forms!YourForm!cboBadge Is Null
 
there aqre several ways to control which records appear in
a report so i'll assume that your report is bound to a
table or query.
The follwoing example is a line of code that is executed
by a button on a form. The form also has a combobox call
cbo_strFName

DoCmd.OpenReport "rpt_Test", acPreview, , "strFName
Like '*" & cbo_strFName & "*'"

This code opens the report "rpt_Test" in preview mode
which only displays the records that meet the content of
the combobox. If the combobox is left blank then all
records will show. This is because I use the * wildcard
before and after ther combobox value.

Hope it helps... Bish
 
Back
Top