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]
"huddie" wrote:
[Quoted Text] > 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 ? > > > -- > -- > Paul Anderson
|