DLookup (again) A97

K

Kahuna

Last one for today guys ... promise!! lol

What's wrong with this structure:

bolFound = DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = "
& strCurrentUserName)

qry_tblLoggedIn is a RWOP query based on a locked table. It does show the
correct rows (and has the field li_user_name)

The error is '... Automation Object Does Not Contain 'irjs' (which is the
contents of the current user var).

Any suggestions gratefully received!
 
J

John Spencer

You need to delimit the string value with quotation marks or apostrophes.

DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = " & Chr(34) &
strCurrentUserName & Chr(34))

OR
DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = """ &
strCurrentUserName & """")

OR
DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = '"
strCurrentUserName & "'")

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
K

Kahuna

Thanks John - knew my syntax was out (that's a seriously complicated
structure)!

Always great support here.

Cheers

--
Kahuna
------------
John Spencer said:
You need to delimit the string value with quotation marks or apostrophes.

DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = " & Chr(34)
& strCurrentUserName & Chr(34))

OR
DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = """ &
strCurrentUserName & """")

OR
DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = '"
strCurrentUserName & "'")

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.

Kahuna said:
Last one for today guys ... promise!! lol

What's wrong with this structure:

bolFound = DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] =
" & strCurrentUserName)

qry_tblLoggedIn is a RWOP query based on a locked table. It does show the
correct rows (and has the field li_user_name)

The error is '... Automation Object Does Not Contain 'irjs' (which is the
contents of the current user var).

Any suggestions gratefully received!
 
J

John Spencer

I hope you understood that I meant to use ONE of the three variations and
not all three.

They were three alternatives to having the text properly delimited.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Kahuna said:
Thanks John - knew my syntax was out (that's a seriously complicated
structure)!

Always great support here.

Cheers

--
Kahuna
------------
John Spencer said:
You need to delimit the string value with quotation marks or apostrophes.

DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = " &
Chr(34) & strCurrentUserName & Chr(34))

OR
DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = """ &
strCurrentUserName & """")

OR
DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = '"
strCurrentUserName & "'")

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.

Kahuna said:
Last one for today guys ... promise!! lol

What's wrong with this structure:

bolFound = DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name]
= " & strCurrentUserName)

qry_tblLoggedIn is a RWOP query based on a locked table. It does show
the correct rows (and has the field li_user_name)

The error is '... Automation Object Does Not Contain 'irjs' (which is
the contents of the current user var).

Any suggestions gratefully received!
 
K

Kahuna

Ha yes John lmao, I did realise.

Thanks for the input again. I have saved all three of your options for
future use.

Muchas Gracias

--
Kahuna
------------
John Spencer said:
I hope you understood that I meant to use ONE of the three variations and
not all three.

They were three alternatives to having the text properly delimited.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.

Kahuna said:
Thanks John - knew my syntax was out (that's a seriously complicated
structure)!

Always great support here.

Cheers

--
Kahuna
------------
John Spencer said:
You need to delimit the string value with quotation marks or
apostrophes.

DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = " &
Chr(34) & strCurrentUserName & Chr(34))

OR
DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = """ &
strCurrentUserName & """")

OR
DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name] = '"
strCurrentUserName & "'")

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.

Last one for today guys ... promise!! lol

What's wrong with this structure:

bolFound = DLookup("[li_date_time]", "qry_tblLoggedIn", "[li_user_name]
= " & strCurrentUserName)

qry_tblLoggedIn is a RWOP query based on a locked table. It does show
the correct rows (and has the field li_user_name)

The error is '... Automation Object Does Not Contain 'irjs' (which is
the contents of the current user var).

Any suggestions gratefully received!
 

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

Top