473,382 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

DLookup criteria problem

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
2 2323
<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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: KLAU | last post by:
I have a field that retrieves information from an expression in a query. I have used a DLookup function to get the calculated field from the query. However, the relationship is 1-to-many so one...
4
by: ShyGuy | last post by:
I have a table with 4 fields. Three are used for criteria. I can get the DLookup to work with 1 criteria with the following but can't get it to work with 2 or three. NumofAppts = DLookup("",...
7
by: Tony Williams | last post by:
Does DLookup work in an expression in a query? I have this expression -(DLookUp("","tblmaintabs","= ")) Which works fine as a calculated control on a form but when I try to use it in a query as an...
8
by: Christine Henderson | last post by:
I have a problem using the above function in the following simplified circumstance: In the lookup table called "Klms Travelled" I have 3 fields, eg: Receiver Name Receiver Suburb ...
6
by: bjaj | last post by:
Hi How do I use a boolean criterian with the funktion DLookup ? I know the syntax for strings, numeric and date as follows For numerical values: DLookup("FieldName" , "TableName" ,...
3
MSeda
by: MSeda | last post by:
I have a loop that is controlled by a Dlookup statement with two criteria. Both criteria fields are checkboxes. I have tried an assortment of quotation marks in the criteria section and cannot get...
11
by: vkong85 | last post by:
I'm creating a database for work and i've run into a snag. Currently i'm using to nested dlookup statements and they are searching for certain criteria in order to find the correct value the...
2
by: Denise | last post by:
Front end is Access 2002, back end is linked Oracle tables. My users need to describe things in feet and inches and want to use the standard ' and " abbrevations. On a testing form I go to a...
1
by: Constantine AI | last post by:
Hi i am trying to get User input if data does not exist within a DLOOKUP table. I have gotten it to work for one record but not multiple, i have tried to incorporate my code into a loop procedure but...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.