How to put a VBA variable into a query as a where condition

inoxo

Registered User.
Local time
Today, 19:46
Joined
Sep 8, 2005
Messages
42
Hi,

It should be simple … may be too simple but …

I have a warehouse application which can manage several warehouses. Each user may however manage only one warehouse.
When the application starts, it reads the warehouseid in a parameter table and stores it into a VBA public variable (mywarehouse) for later use.

My problem is to reuse this variable as a where condition in the underlying query (warehouseid = mywarehouse) every time I open a form or a report, so that the user can only see what’s related to his warehouse.

I mean with « underlying query » : a saved query with a title that you can see in the database bindow.

I could embed the underlying queries as SQL statements, with the warehouse where condition, in every form/report load event, but this is a very heavy solution since I should then convert all underlying queries into embedded SQL statements.

I guess I could do it better otherwise by keeping the underlying queries.

Any idea ?

Thanks
 
You could have your user enter there warehouse on a form then reference the control on the form as your parameter.


forms![Form Name]![Control Name]
 

Users who are viewing this thread

Back
Top Bottom