sql server msde:
Declare @MyVariable int
SELECT @MyVariable=@@GlobalVariable
SELECT col1 from mytable where x = @MyVariable
should work...
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
[quoted text, click to view] "June Macleod" <junework@hotmail.com> wrote in message
news:%23cCzsmWzEHA.2040@tk2msftngp13.phx.gbl...
> Can anyone tell me how I can use a global varible as a selection criteria
> in
> a Query?
>
>
> I previously had a query which I ran in MSAcces with the jet engine which
> had in the criterial line a reference to a function which returned the
> value
> of a global variable.
>
> I have now moved to Access 2003 with an MSDE backend and this query no
> longer works.
>
> SELECT dbo.logTestQuestions.*
> FROM dbo.logTestQuestions
> WHERE (logTestID = getrerunid())
>
> and in the Module the function is defined as:
>
> Public Function getReRunID()
> getReRunID = pr.rerunID
> End Function
>
> where pr.rerunID is a global variable.
>
>
> When I run my query I get an error message of:
>
> ADO error: 'getrerunid' is not a recognised function name
>
>
>
>
> Many thanks
>
> June
>
>