By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,310 Members | 1,885 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,310 IT Pros & Developers. It's quick & easy.

data type mismatch in criteria expression

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a

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

P: n/a

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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.