471,309 Members | 1,285 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,309 software developers and data experts.

Run-time Error message #3464 - Data Type mismatch in criteria expression

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 was once a type Number,
but I had to change it to a type Text due to I needed to have two zeros
at the beginning of the Asset Number (EX: 001234.)

The rease I am writing is that now when I run from My Query Menu a
choice called "05 - Specific Assets (Choose Assets from List)", where
the user can choose which assets the user wants to view on a report,
just by clicking on the list box called AssetNumber, that is on the
Query Menu.

The Row Source for the List box has the following information:

SELECT DISTINCTROW Equipment.Asset_Number
FROM Equipment;

The After Update information for the AssetNumber List Box has the
following info:

Private Sub AssetNumber_AfterUpdate()
Dim strSql As String
Dim intI As Integer
Dim strSelectedValues As String

strSql = "Select * from Equipment where ("

With Me.AssetNumber
For intI = 0 To .ListCount - 1
If .Selected(intI) Then
strSelectedValues = strSelectedValues & " Or " &
"(([Asset_Number])= " & .ItemData(intI) & ")"
End If
Next intI
End With

strSelectedValues = Trim(Right(strSelectedValues,
Len(strSelectedValues) - 4))

Me.txtWhereClause = strSql & strSelectedValues & ");"
End Sub

There is also a Query called AssetQuery that is associated with this:

SELECT Equipment.* AS expr, Equipment.Asset_Number
FROM Equipment
WHERE (((Equipment.Asset_Number)=[Forms]![Query_Menu]![AssetNumber]));

Finally, the form that is suppose to show the Assets, but when I try to
run the report from the Query Menu, I get that Data-type mismatch

Any ideas?

Jerry Schwartz

Nov 13 '05 #1
1 6317
So assetNumber, now text, needs quotes in the WHERE clauses
SELECT Equipment.* AS expr, Equipment.Asset_Number
FROM Equipment

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by James | last post: by
7 posts views Thread by erniedude | last post: by
4 posts views Thread by Wasi Rehman | last post: by
26 posts views Thread by Chief | last post: by
8 posts views Thread by Sean DiZazzo | last post: by
16 posts views Thread by maya | last post: by

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.