Combobox All to Report

C

Cesar Zapata

Hello,

I have a ReportSel form where you can , with a combobox, choose the name of
the employee to report on. The control source of the comobox comes from a
table.

What I want to do is that when I select a employee from the combobox that
the form will call the report for that employee and If I leave the combobox
blank to report All employees.

I already have a query done for the report.

The only thing I can't do is to have the query look at the combobox.

appreciate any help.

thanks,
CZ
 
A

AlCamp

Cesar,
In the query behind your report, in the Employee column, use this
criteria...(use your names)
Like Forms!ReportSel!cboEmployee & "*"
If Smith is entered, you'll report on Smith. If nothing is enetered,
you'll report on all the employees.

Note: Using the employee name might work just fine in your case, but it
would be better if you used a unique identifier. Something like an
EmployeeIDNo, that only one employee has. Name could refer to more than one
employee.

hth
Al Camp
 
I

Ian King

Try typing this as a new field in the report's query, obviously changing the
form and field names as appropriate:

iif(YourFormName!ComboName is null, true, iif(YourFormName!ComboName =
StaffNameFieldInTable, true, false))

Then set the criteria to true.

Hope this works.

Ian King
 

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