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)
DLookup("FieldName" , "TableName" , "Criteria= 'string'")
For dates:
DLookup("FieldName" , "TableName" , "Criteria= #date#")
For booleans:
?????????????
best regards
Ronald 6 10676
No delimiters. Same as numbers, e.g.:
DLookup("FieldName" , "TableName" , "Criteria = False")
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
<bj**@vestas.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com... 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) DLookup("FieldName" , "TableName" , "Criteria= 'string'")
For dates: DLookup("FieldName" , "TableName" , "Criteria= #date#")
For booleans: ?????????????
best regards Ronald
Hi Allen
And thank you
It is working fine with only the boolean criteria, but when I add other
criteries I can't get it working.
Look at this:
Dim VareVar As String
Dim SerialNoVar As String
Dim DatoAfslVar As Date
If Not IsNull(VareVar = DLookup("VareNr", "T_FejlRecords",
"[VareNr] = '" & VareVar & "'" _
& "And [SerieNr] = '" &
SerialNoVar & "'" _
& "And [DatoAfsl] = #" &
DatoAfslVar & "#" _
& "And Repair = TRUE")) Then
This statement don't take notice of the "And Repair = TRUE"
What am I doing wrong ?
best regards
Ronald bj**@vestas.com wrote: Hi Allen
And thank you It is working fine with only the boolean criteria, but when I add other criteries I can't get it working.
Look at this:
Dim VareVar As String Dim SerialNoVar As String Dim DatoAfslVar As Date
If Not IsNull(VareVar = DLookup("VareNr", "T_FejlRecords", "[VareNr] = '" & VareVar & "'" _ & "And [SerieNr] = '" & SerialNoVar & "'" _ & "And [DatoAfsl] = #" & DatoAfslVar & "#" _ & "And Repair = TRUE")) Then
This statement don't take notice of the "And Repair = TRUE"
What am I doing wrong ?
best regards Ronald
I always assign the criteria to a string variable so I can easily msgbox or
debug.print it to make sure the format is correct before passing it on to
the next part of the procedure. I also tend to put brackets arount each
criteria to make it more readable.
--
regards,
Br@dley
Looks like on the "And Repair = TRUE" you strayed from the format you
were using on the other comparisons. Try: " And [Repair]=TRUE" or " And
[Repair]=" & -1 bj**@vestas.com wrote: Hi Allen
And thank you It is working fine with only the boolean criteria, but when I add other criteries I can't get it working.
Look at this:
Dim VareVar As String Dim SerialNoVar As String Dim DatoAfslVar As Date
If Not IsNull(VareVar = DLookup("VareNr", "T_FejlRecords", "[VareNr] = '" & VareVar & "'" _ & "And [SerieNr] = '" & SerialNoVar & "'" _ & "And [DatoAfsl] = #" & DatoAfslVar & "#" _ & "And Repair = TRUE")) Then
This statement don't take notice of the "And Repair = TRUE"
What am I doing wrong ?
best regards Ronald bj**@vestas.com wrote in
news:11**********************@u72g2000cwu.googlegr oups.com: Hi Allen
And thank you It is working fine with only the boolean criteria, but when I add other criteries I can't get it working.
Look at this:
Dim VareVar As String Dim SerialNoVar As String Dim DatoAfslVar As Date
If Not IsNull(VareVar = DLookup("VareNr", "T_FejlRecords", "[VareNr] = '" & VareVar & "'" _ & "And [SerieNr] = '" & SerialNoVar & "'" _ & "And [DatoAfsl] = #" & DatoAfslVar & "#" _ & "And Repair = TRUE")) Then
This statement don't take notice of the "And Repair = TRUE"
What am I doing wrong ?
best regards Ronald
If you were to put the criteria into a variable and examine the
result in the immediate window, you would see that it returns
"[VareNr] = 'xxxxxxx'And [SerieNr] = 'yyy'And [DatoAfsl] =
#04-21-06#And Repair = TRUE"
You need to insert some spaces in front of your ANDs
You also need to verify that VareVar name You are trying to set
it and use it at the same time.
--
Bob Quintal
PA is y I've altered my email address.
Thank You all
It's working now
Ronald This thread has been closed and replies have been disabled. Please start a new discussion. 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...
|
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("",...
|
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...
|
by: MLH |
last post by:
DLookup("", "tblPreliminaryVINs",
"=Forms!frmVINODO!SerialNum")
is giving me a Type Mismatch error. That's confusing to me
and I don't know how to circumvent it. The field in...
|
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)...
|
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...
|
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...
|
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...
|
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...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
| |