use form to enter report criteria

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
 
J

Joan Wild

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
 
B

Bish

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top