Re: function as criteria for a query
- From: "Duane Hookom" <duanehookom@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 23 Jun 2005 20:31:13 -0500
Write the value to a table with a single record in SQL Server.
--
Duane Hookom
MS Access MVP
"Paul" <Paul@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C5E5B509-9989-473C-960A-CA5DFEBDD8B4@xxxxxxxxxxxxxxxx
> What i'm trying to do is base an SQL (stored procedure / view) query
> on the Public variable "userId" so that various forms
> can display records relevant to the 'logged-in' user.
>
> This method works in an MDB query like a charm!
> What i'd like to do is use a similar method
> the ADP version of the database using sql server 2000 (desktop engine)
>
> I have created a public variable called "userId" it stores the user id
> number
> which was entered in a text box on a 'log-in' form.
>
> The function i've created uses the following syntax (as recomended in
> KB210388)
>
> Public Function fnUserId()
> fnUserId = userId
> End Function
>
> The syntax of the stored procedure is as follows:
>
> SELECT dbo.tblUsers.*
> FROM dbo.tblUsers
> WHERE (Id = fnUserId())
>
> Error message returned "ADO error 'fnUserId' is not a recognized function
> name"
>
> How do I get the stored procedure / view to base the value in the WHERE
> clause that is being held
> held in the public variable "userId"?
>
> "Duane Hookom" wrote:
>
>> As you have experienced, you can't use an Access function in an ADP
>> query/view. SQL 2000 does have the ability to create user-defined
>> functions.
>> Since we know nothing about your function, we can't offer alternative
>> syntax.
>>
>> --
>> Duane Hookom
>> MS Access MVP
>>
>>
>> "Paul" <Paul@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:9B038810-E1AF-47AB-8D6E-5A89F76E4EFB@xxxxxxxxxxxxxxxx
>> > i've successfully used a function result as the criteria for a query in
>> > access mdb database (as in KB210388) but i cant use the function in a
>> > similar
>> > query in an ADP database. I get the error: "ADO error 'functionName()'
>> > is
>> > not
>> > a recognized function name". Can anyone show me how to sort this out!
>>
>>
>>
.
- Follow-Ups:
- Re: function as criteria for a query
- From: Paul
- Re: function as criteria for a query
- References:
- function as criteria for a query
- From: Paul
- Re: function as criteria for a query
- From: Duane Hookom
- Re: function as criteria for a query
- From: Paul
- function as criteria for a query
- Prev by Date: Re: totals in query
- Next by Date: Newbie - Summary Query?
- Previous by thread: Re: function as criteria for a query
- Next by thread: Re: function as criteria for a query
- Index(es):
Relevant Pages
|