MSeda 159
Recognized Expert New Member
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( "[PPO Part#]", "Quoted Parts Table", "[PPO Quote Acc] = Yes And [PPO Order Parts] = Yes"))
I've never quite understood the logic of the quotation marks in the criteria statement but it usually works after several tries, this is the first time I,ve used Dlookup with 2 criteria. Any help will be appreciated
3 4523 NeoPa 32,568
Recognized Expert Moderator MVP
The amended code should work for you. - Do Until IsNull(DLookup( _
-
Expr:="[PPO Part#]", _
-
Domain:="Quoted Parts Table", _
-
Criteria:="(([PPO Quote Acc]) And ([PPO Order Parts]))"))
I've assumed from your code that [PPO Quote Acc] and [PPO Order Parts] fields are both of type Boolean so will not need to be compared to Yes.
If they are text fields and you need to compare against the text "Yes" then that is different and will need a code change.
MMcCarthy 14,534
Recognized Expert Moderator MVP Two things:
Table and field names cannot contain blank spaces so they need to be inclosed in square brackets to show what they are.
Yes is text and all text has to be surrounded by single or double quotation marks (single inside a query). therefore
Do Until IsNull(DLookup( "[PPO Part#]", "[Quoted Parts Table]", "[PPO Quote Acc] = 'Yes' And [PPO Order Parts] = 'Yes'"))
NeoPa 32,568
Recognized Expert Moderator MVP
I missed out on the '[]' for the table name. - Do Until IsNull(DLookup( _
-
Expr:="[PPO Part#]", _
-
Domain:="[Quoted Parts Table]", _
-
Criteria:="(([PPO Quote Acc]) And ([PPO Order Parts]))"))
However, Yes can be a string but can also be an alternative for True - a predefined constant within VBA.
If you want Yes, the code above is ok, if you want "Yes" then change the last line to :- - Criteria:="(([PPO Quote Acc] = 'Yes') And ([PPO Order Parts] = 'Yes'))"))
as shown by MMcCarthy above.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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.
|
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.
|
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
|
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 ...
|
by: chris.thompson13 |
last post by:
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
| |
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)
|
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...
|
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...
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |