Combo Box to select customer for report

  • Thread starter Thread starter Haji
  • Start date Start date
H

Haji

Hello,

I am working on a reporting application for our sales
force. What I want to do is to have a rep select one of
their customers and then run a report on all of the 2003
transactions for that customer.

I created a form called SelectCustomerAnna. Anna is one of
our reps. In it is two objects. The first is a combo box
called ComboAnna. This is fed by a query called
CustomersAnna which has a field called FullName which are
names of our customers (there is no Customer ID). I also
have a query called 2003TrxAnna which also has FullName
along with product names, transaction dates and
quantities. FullName is the common field between the
customer table and the transaction table.

I created report also called 2003TrxAnna which is based on
the 2003TrxAnna query and runs all transaction for all of
Anna's customers. I grouped it by FullName so there is a
FullName header. I then created a button below my combo
box which is called Command9. It runs this report.

What I want to do is to tie these two objects together.
When a user selects a customer from the combo box and then
clicks on the Command9 button it runs the report but only
gives transactions for that customer rather than all of
Anna's customers.

Can anyone help. I am not much of a VBA user.

Thanks,

Haji
 
In the query feeding the report, set the criteria for the customer to

Like IIF(IsNull([Forms]![SelectCustomerAnna]![ComboAnna]), "*",
[Forms]![SelectCustomerAnna]![ComboAnna])

This will limit the query to returning data for only the customer selected in the combo
box. The field in the query you do this to will have to be the field that holds the same
data as the bound column of the combo box.

The advantage of the Like is that if the combobox is Null, then the * will take over and
return all records.
 
Back
Top