Group:  Microsoft Access ยป microsoft.public.access.modulesdaovba
Thread: How do I set global variables in an Access Database Project(ADP)?

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

How do I set global variables in an Access Database Project(ADP)?
huddie 29.09.2006 14:59:02
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
RE: How do I set global variables in an Access Database Project(ADP)?
Klatuu 29.09.2006 15:50:01
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

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net