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

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

P: n/a
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
error.

Any ideas?

Jerry Schwartz
Ar******@hot-shot.com

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
So assetNumber, now text, needs quotes in the WHERE clauses
ie.
SELECT Equipment.* AS expr, Equipment.Asset_Number
FROM Equipment
WHERE
(((Equipment.Asset_Number)="[Fo*rms]![Query_Menu]![AssetNumber*]"));

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.