473,756 Members | 5,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("Fulln ame","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 2345
<ch************ **@ntlworld.com > wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.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("Fulln ame","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("Fulln ame","qryDaily" ,"[Duty]='E1'")

or

Pair up "double" quotes:

=DLookUp("Fulln ame","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("Fulln ame","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.goo glegroups.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("Fulln ame","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
20803
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 site could have many units. How do I have the DLookUp field value change to a newly calcuated field when I navigate through the units? please see example below: On the Form: A site can have many units.
4
21104
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("", "LookUpAppts", " = " & Forms!!NumofPeople) Can someone tell me how to add multiple criteria? I tried "And" but it doesn't seem to work.
7
2258
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 expression I don't get any result. I want to use the Sum of the result in a query on which I will base a report. TIA Tony
8
4319
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 Klms Distance Jones Melbourne 500 Harrison Sydney 200 Ford Brisbane 700 Jones ...
6
10744
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" , "Criteria = n") For strings: (note the apostrophe before and after the value)
3
4527
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 the Dlookup to run. My statement looks like this (I have removed the extraneous quotes since they are not working anyway): Do Until IsNull(DLookup("", "Quoted Parts Table", " = Yes And = Yes")) I've never quite understood the logic of the...
11
5495
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 statement reads: = DLookup ( "!" ," tbl Cost Center", "!= DLookUp("!","tbl people","!= Forms!!")") i've swapped the quotations marks and have tried god knows how many syntaxs for numeric and text. The first dlookup criteria is text. the second dlookup...
2
3658
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 record with double or single quotes in the location description and click a button to see if Access can tell me the ID number and find its way back to the original record. When the text contains double quotes the FindFirst works but the Dloookup...
1
3652
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 i have failed. Could anyone give me any advice? Dim db As Database Dim rst As Recordset Dim rst2 As Recordset Dim strSQL As String Dim Widthval As Integer Dim Depthval As Integer Dim Heightval As Integer Dim...
0
10031
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9838
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9708
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2665
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.