Trying to look up a value based on 2 criteria. Can't seem to debug the error thanks for your help!
[Punch ID] = Nz(DLookup("[Punch ID]", "[Copy of Employee Work Statistics1]", "Employee='" & Forms![Royal time Stamp]![Driver] & "And [Date]='" & Date & "'"), 0)
Ah, something else that I missed. You will need to add an ending single quote and a space before the word and in your criteria. So it would be like this: - [Punch ID] = Nz(DLookup("[Punch ID]", "[Copy of Employee Work Statistics1]", "Employee='" & Forms![Royal time Stamp]![Driver] & "' And [Date]=#" & Date & "#"), 0)
7 2133
The problem is your [Date] field criteria. You are using single quotes, but you need to use # instead. So it would be something like this: - [Punch ID] = Nz(DLookup("[Punch ID]", "[Copy of Employee Work Statistics1]", "Employee='" & Forms![Royal time Stamp]![Driver] & "And [Date]=#" & Date & "#"), 0)
Thank you Seth for your response.
After changes I am getting run-time error '3075'
Syntax error in string in query expression 'Employee='Batson,Leroyand [Date]=#3/12/2014'.
Ah, something else that I missed. You will need to add an ending single quote and a space before the word and in your criteria. So it would be like this: - [Punch ID] = Nz(DLookup("[Punch ID]", "[Copy of Employee Work Statistics1]", "Employee='" & Forms![Royal time Stamp]![Driver] & "' And [Date]=#" & Date & "#"), 0)
Works perfect. Thanks for the help and education.
No problem. Glad to be able to help.
Seth do you mind taking a look at one more. I realized I needed a third criteria. Here is the code with added criteria.
[Punch ID] = Nz(DLookup("[Punch ID]", "[Copy of Employee Work Statistics1]", "Employee='" & Forms![Royal time Stamp]![Driver] & "' And [Date]=#" & Date & "#" & "' And [Trip Sign On]=0"), 0)
Only one question is allowed per thread, but I'll give you a bit of direction as it is kind of related. Drop the single quote before your second and. If you continue to have issues with this, please start a new thread and I or someone else will continue to help you.
I just saw that you did post a new thread. I'll post over there as well.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jack |
last post by:
Hi,
I am trying to test a sql statement in Access which gives me
the error as stated in the heading.
The sql statement is built as a part of asp login verification,
where the userid and password...
|
by: Chicken Kebab Abdullah |
last post by:
Does anyone know why I get the error 3464 Data type mismatch from the
following code.
I have a form with a combo(to choose a consumable) and 2 list boxes on
it.
list on left is all printers...
|
by: John Smith |
last post by:
Hi
I am getting the above error when I try to run the union query shown
below
select all as ,
as , as ,
as , ,, ,, , , as , as , as ,
as , as
from
|
by: Alex |
last post by:
help.
Deploying a .Net Application using ADO and MS Access (Jet
4.0) and MDAC 2.8.
Get error: OleDbError .... Data type mismatch in criteria
expression ...
The application works fine in...
|
by: David |
last post by:
Hi,
Getting the following error:-
Microsoft JET Database Engine error '80040e07'
Data type mismatch in criteria expression.
The code is as follows, and the last line is the one that...
|
by: christianlott1 |
last post by:
Taken (and modded) from http://www.codeguru.com/vb/gen/vb_misc/tips/
article.php/c13137
'RESULTS' table:
REF_STRING - TEXT 250
TEST_STRING - TEXT 250
MATCH_VALU - SINGLE FIXED 2 DECIMAL...
|
by: blackburnj55 |
last post by:
Hi,
I am constructing a website for a bike shop. I am using dreamweaver and an access database to create it.
I have made a query where two criteria are entered to get results. These are :...
|
by: eyoung1 |
last post by:
this works
sSQL = "SELECT *" & _
" FROM Expenses2008" & _
" WHERE Amount Like '%" & Request.Form("searchItem") & "%'"
set rs = Connect.Execute(sSQL)
however if I enter an amount of 99 it...
|
by: ezechiel |
last post by:
Hello,
I know others have the same problem here, I tried (a lot! ) different solutions but still can't get around the problem.. :s
Here's the code:
Private Sub cb_swedit_sopi_AfterUpdate()...
|
by: jocelyn ooi |
last post by:
Anyone can help me why my code keep pop put this error ???
StrLeaveSql = "SELECT * FROM tblLeave WHERE emp_id = '" & rstReplacement!emp_id & "'" & _
" AND lea_effective_date = '" &...
|
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: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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,...
|
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...
|
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...
|
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...
|
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...
| |