473,473 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

data type mismatch in criteria expression

I have a form command with the following code in it:

Dim Worder As Variant
Dim rcrd As Variant
_____________________________________
Worder = InputBox("Work Order ID", "Info for pulled order")
rcrd = DLookup("[WorkOrderID]", "TBLdata", "[WorkOrderID] = " & Worder)

If IsNull(rcrd) Then
_________________________________________

I originally had teh WorkOrderID field in my TBLdata set as "Number"
and the code worked perfectly. However, I just realized that it needs
to be a text field, and when I changed it to text, I recieved the
error: "data type mismatch in criteria expression"

Any Ideas??

Thanks

Nov 13 '05 #1
3 3876

ma************@eaton.com wrote:
I have a form command with the following code in it:

Dim Worder As Variant
Dim rcrd As Variant
_____________________________________
Worder = InputBox("Work Order ID", "Info for pulled order")
rcrd = DLookup("[WorkOrderID]", "TBLdata", "[WorkOrderID] = " & Worder)
If IsNull(rcrd) Then
_________________________________________

I originally had teh WorkOrderID field in my TBLdata set as "Number"
and the code worked perfectly. However, I just realized that it needs to be a text field, and when I changed it to text, I recieved the
error: "data type mismatch in criteria expression"

Any Ideas??

Thanks


try "[WorkOrderID] = " & CStr(Worder) & ";"

or "[WorkOrderID] = '" & Worder & "';"

or "[WorkOrderID] = " & Chr(34) & Worder & Chr(34) & ";"

or "[WorkOrderID] = """" & Worder & """""

If none of those work post back.

James A. Fortune

Nov 13 '05 #2

ji********@compumarc.com wrote:
ma************@eaton.com wrote:
I have a form command with the following code in it:

Dim Worder As Variant
Dim rcrd As Variant
_____________________________________
Worder = InputBox("Work Order ID", "Info for pulled order")
rcrd = DLookup("[WorkOrderID]", "TBLdata", "[WorkOrderID] = " &

Worder)

If IsNull(rcrd) Then
_________________________________________

I originally had teh WorkOrderID field in my TBLdata set as "Number" and the code worked perfectly. However, I just realized that it

needs
to be a text field, and when I changed it to text, I recieved the
error: "data type mismatch in criteria expression"

Any Ideas??

Thanks


try "[WorkOrderID] = " & CStr(Worder) & ";"

or "[WorkOrderID] = '" & Worder & "';"

or "[WorkOrderID] = " & Chr(34) & Worder & Chr(34) & ";"

or "[WorkOrderID] = """" & Worder & """""

If none of those work post back.

James A. Fortune

Oops. Take off the ; parts.

JAF

Nov 13 '05 #3
I tried this code:

"[WorkOrderID] = " & Chr(34) & Worder & Chr(34) & ";"

and it worked perfrectly

Thanks

Matt

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ArcadeJr | last post by:
Good morning all! I have been getting a Run-time Error message #3464 - Data Type mismatch in criteria expression. While trying to run a query. I have a database where the field Asset_Number...
4
by: N J | last post by:
Hi, CurrentDb.Execute "Update tblDelayedOrders Set DELAYED = True Where ID = " & Me.txtOrderNumber & ";", dbfailonerror Me.StatusListBox.AddItem "ORDER # " & Me.txtOrderNumber & " MARKED AS...
3
by: martlaco1 | last post by:
Trying to fix a query that (I thought) had worked once upon a time, and I keep getting a Data Type Mismatch error whenever I enter any criteria for an expression using a Mid function. Without the...
1
by: amitbadgi | last post by:
I am getting the following error while converting an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Data type mismatch in criteria expression. ...
2
by: technocraze | last post by:
Hi guys, Implementations application & programming environ MS Acess + Visual Basic Table fields Serialno (pk) - Auto number StudentId - text Course - text intake - number
10
by: aaronrm | last post by:
I have a real simple cross-tab query that I am trying to sum on as the action but I am getting the "data type mismatch criteria expression" error. About three queries up the food chain from this...
2
by: psychomad | last post by:
Please, can someone help me out to solve this error, i've been searching throughout my codes and yet i didnt succeed in finding the error!!!! The Error is: Server Error in '/' Application....
19
by: Lysander | last post by:
I have written a query that takes three integers representing day,month and year, forms a date from them and compares this date to the date the record was entered and returns any records where the...
1
by: DC | last post by:
Any idea why this code would cause a error? The SQL that gets executed seems to be (using record 1132 as an example) DELETE FROM user_table WHERE ID = '1132'; And the value of...
2
by: tmoon3 | last post by:
Hello, This must be a simple mistake, but for some reason I cannot seem to get around it. I am simply trying to create a report of all employees that have a date filled in in a training column...
0
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...
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...
1
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...
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...
1
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: 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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.