473,411 Members | 2,030 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,411 software developers and data experts.

Dlookup returning error '3075' data type mismatch

46
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)
Mar 12 '14 #1

✓ answered by Seth Schrock

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:
Expand|Select|Wrap|Line Numbers
  1. [Punch ID] = Nz(DLookup("[Punch ID]", "[Copy of Employee Work Statistics1]", "Employee='" & Forms![Royal time Stamp]![Driver] & "' And [Date]=#" & Date & "#"), 0)

7 2133
Seth Schrock
2,965 Expert 2GB
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:
Expand|Select|Wrap|Line Numbers
  1. [Punch ID] = Nz(DLookup("[Punch ID]", "[Copy of Employee Work Statistics1]", "Employee='" & Forms![Royal time Stamp]![Driver] & "And [Date]=#" & Date & "#"), 0)
Mar 12 '14 #2
Vasago
46
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'.
Mar 12 '14 #3
Seth Schrock
2,965 Expert 2GB
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:
Expand|Select|Wrap|Line Numbers
  1. [Punch ID] = Nz(DLookup("[Punch ID]", "[Copy of Employee Work Statistics1]", "Employee='" & Forms![Royal time Stamp]![Driver] & "' And [Date]=#" & Date & "#"), 0)
Mar 12 '14 #4
Vasago
46
Works perfect. Thanks for the help and education.
Mar 12 '14 #5
Seth Schrock
2,965 Expert 2GB
No problem. Glad to be able to help.
Mar 12 '14 #6
Vasago
46
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)
Mar 12 '14 #7
Seth Schrock
2,965 Expert 2GB
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.
Mar 12 '14 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

7
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...
2
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...
0
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
4
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...
5
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...
6
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...
5
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 :...
2
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...
14
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()...
2
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 = '" &...
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
0
BarryA
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...
0
marktang
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,...
0
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...
0
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,...
0
jinu1996
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...
0
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...
0
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...
0
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...

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.