Selecting from 2 list boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
In my form I want to be able to select 1 item from 1 list box and another
item from another list box to give me a report based on the selections. It
works if I chose something from 1 list box but I'm not sure of the syntax to
combine the two strWhereCategory's. Below are the strWhereCategory's
separately.

strWhereCategory = "SupplierID = Forms![Product Enquiries By
Supplier]!SupplierList"

strWhereCategory1 = "ProductID = Forms![Product Enquiries By
Supplier]!ProductList"

In my switch statement I have the following code which opens a report based
on the selection from the first list box:
Case 3
DoCmd.OpenReport "List of Products By Supplier and Job",
acPreview, , strWhereCategory

Does anyone know how to combine these so that the report is based on
selections from both list boxes?
Regards
Sean
 
Assuming both SupplierID and ProductID are numeric, use the following

strWhereCategory = "SupplierID = " & Forms![Product Enquiries By
Supplier]!SupplierList & " And ProductID = " & Forms![Product Enquiries By
Supplier]!ProductList
 
Thanks
That worked

Dennis said:
Assuming both SupplierID and ProductID are numeric, use the following

strWhereCategory = "SupplierID = " & Forms![Product Enquiries By
Supplier]!SupplierList & " And ProductID = " & Forms![Product Enquiries By
Supplier]!ProductList


Sean said:
Hi
In my form I want to be able to select 1 item from 1 list box and another
item from another list box to give me a report based on the selections. It
works if I chose something from 1 list box but I'm not sure of the syntax to
combine the two strWhereCategory's. Below are the strWhereCategory's
separately.

strWhereCategory = "SupplierID = Forms![Product Enquiries By
Supplier]!SupplierList"

strWhereCategory1 = "ProductID = Forms![Product Enquiries By
Supplier]!ProductList"

In my switch statement I have the following code which opens a report based
on the selection from the first list box:
Case 3
DoCmd.OpenReport "List of Products By Supplier and Job",
acPreview, , strWhereCategory

Does anyone know how to combine these so that the report is based on
selections from both list boxes?
Regards
Sean
 
Back
Top