How do I set global variables in an Access Database Project(ADP)?

G

Guest

I'm using Access with SQL Server 2000 to develop a database, and want to set
global Transact SQL variables, but I don't know how. How do a set a variable
that can be seen by any query, etc., in the database ?
 
G

Guest

In Access, variables can't be seen by SQL at all.
The easiest way to do this is create a form with a text box control for each
value you want to pass to a query. Make the Default Value property of each
control the value you want to pass to the query. The form can be hidden, but
will need to be open at any time you want to use a query that references it.
(Having a form always open has some other valuable uses as well, but I
digress)
Queries can reference controls on a form. So, as an example:

WHERE [SOME_FIELD] = [Forms]![NameOfForm]![NameOfControl]
 

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