DLook Syntax Help - for Ken Snell

D

Dan

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>

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


.
..
 
K

Ken Snell

Please stay in the same thread. Reply posted there.

--

Ken Snell
<MS ACCESS MVP>

Dan said:
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>

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


.
.
 
D

Dan

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 said:
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>

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


.
..
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top