By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,649 Members | 1,572 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,649 IT Pros & Developers. It's quick & easy.

DLookup criteria problem

P: n/a
I am having a problem setting the criteria part of the DLookup method
correctly and am consequently getting an error message.
I have a database of staff duties, part of which is a query (qryDaily)
that returns all staffs duties for a selected day.e.g.

Fullname Duty

Name1 E1
Name2 Sick
Name3 Pwk N2
Name4 N4
Name5 Pwk D1

etc

I would like to produce a daily report and have various textboxes that
use the DLookup function to return the name of the person on specific
duties.

To that end I have set up a text box with the Control Source as

=DLookUp("Fullname","qryDaily","[Duty]=E1") hoping that it would return
the result Name1 (for the example data above) but all I get is an error
message. I have tried various ways of arranging the criteria part of
this method but without success. Could somebody point me in the right
direction as regards the correct wording for the criteria please?

Many thanks

Chris Thompson.

Feb 23 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
<ch**************@ntlworld.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I am having a problem setting the criteria part of the DLookup method
correctly and am consequently getting an error message.
I have a database of staff duties, part of which is a query (qryDaily)
that returns all staffs duties for a selected day.e.g.

Fullname Duty

Name1 E1
Name2 Sick
Name3 Pwk N2
Name4 N4
Name5 Pwk D1

etc

I would like to produce a daily report and have various textboxes that
use the DLookup function to return the name of the person on specific
duties.

To that end I have set up a text box with the Control Source as

=DLookUp("Fullname","qryDaily","[Duty]=E1") hoping that it would return
the result Name1 (for the example data above) but all I get is an error
message. I have tried various ways of arranging the criteria part of
this method but without success. Could somebody point me in the right
direction as regards the correct wording for the criteria please?

Many thanks

Chris Thompson.


Duty is obviously a text field, hence its value needs to be surrounded by
quotes.

You can use "single" quotes:

=DLookUp("Fullname","qryDaily","[Duty]='E1'")

or

Pair up "double" quotes:

=DLookUp("Fullname","qryDaily","[Duty]=""E1""")

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
Feb 23 '06 #2

P: n/a
Is there a parameter in qryDaily that needs a value? Also, it appears that
[Duty] is a text data type. If so, the syntax would be:

=DLookUp("Fullname","qryDaily","[Duty]='E1'")

Note the addition of single quotes around E1.

--
Wayne Morgan
MS Access MVP
<ch**************@ntlworld.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I am having a problem setting the criteria part of the DLookup method
correctly and am consequently getting an error message.
I have a database of staff duties, part of which is a query (qryDaily)
that returns all staffs duties for a selected day.e.g.

Fullname Duty

Name1 E1
Name2 Sick
Name3 Pwk N2
Name4 N4
Name5 Pwk D1

etc

I would like to produce a daily report and have various textboxes that
use the DLookup function to return the name of the person on specific
duties.

To that end I have set up a text box with the Control Source as

=DLookUp("Fullname","qryDaily","[Duty]=E1") hoping that it would return
the result Name1 (for the example data above) but all I get is an error
message. I have tried various ways of arranging the criteria part of
this method but without success. Could somebody point me in the right
direction as regards the correct wording for the criteria please?

Many thanks

Chris Thompson.

Feb 23 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.