RE: DLook Syntax Help - for Ken Snell

From: Dan (anonymous_at_discussions.microsoft.com)
Date: 07/29/04


Date: Thu, 29 Jul 2004 16:50:31 -0700

Hi Wez:

Still the same ... I took out the quotes...I am thinking
stupid now, what about that nothing is refreshed and it
gets the first code, still?!...

Dan
>-----Original Message-----
>Hope you dont mind my butting in. I think the problem
may lie in the use of the single and double quotes in the
criteria. I have had this problem and it gave me the same
error message as you are getting. Below is what I think
it should be:
>
>"[UserID] = " & UserID))
>
>You dont need any quotes after the equals sign because
UserID is a variable. If you wanted to use a string as the
criteria you would need single quotes as below:
>
>"[UserID] = 'CriteriaString'"))
>
>Note that here, CriteriaString is enclosed in single
quotes, then a final double quote encloses the whole
criteria expression.
>
>DLookup is VERY fussy about the syntax of criteria
expressions, for more info study the DLookup Help file.
>
>Wes.
>
>"Dan" wrote:
>
>> Hi Ken:
>>
>> Thank you but is still giving me this message:
>>
>> Application can't find the field '|' referred to in
your
>> expression
>>
>> Thaks,
>>
>> Dan
>> >-----Original Message-----
>> >If IsNull(DLookup("[UserID]", "[pswc]", _
>> > "[UserID]='" & [UserID] & "'")) = False Then
>> >
>> > DoCmd.OpenForm stDocName, , , stLinkCriteria
>> >
>> >
>> >--
>> >
>> > Ken Snell
>> ><MS ACCESS MVP>
>> >
>> >"Dan" <anonymous@discussions.microsoft.com> wrote in
>> message
>> >news:698201c47592$df70e790$a601280a@phx.gbl...
>> >> Hi:
>> >>
>> >> What would be the syntax for a Dlookup to find a
name
>> in a
>> >> table; if it finds it then open a form...this is not
>> >> working??
>> >>
>> >> If (DLookup("[UserID]", "[pswc]", _
>> >> "[UserID]='" & [UserID] & "'")) Then
>> >>
>> >> DoCmd.OpenForm stDocName, , , stLinkCriteria
>> >>
>> >> Thanks,
>> >>
>> >> Dan
>> >
>> >
>> >.
>> >
>> ..
>>
>>
>>
>.
>


Quantcast