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

Please help! Data type mismatch in criteria expression.

P: 5
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 : Category and price(RRP).

Here is the SQL:

"SELECT Category, Description, Image, ProductRef, RRP, SalePrice FROM BOM WHERE Category = '" + Replace(Recordset1__MMColParam, "'", "''") + "' AND RRP < '" + Replace(Recordset1__MMColParam2, "'", "''") + "'"

I get the following error:

Microsoft JET Database Engine error '80040e07'

Data type mismatch in criteria expression.

First of all is my code correct?
What does this error mean?

When I use simply one search criteria i have no problems. it only occurs with the two search criteria query.

any help greatly appreciated, pulling out hair!
Apr 18 '07 #1
Share this Question
Share on Google+
5 Replies


pks00
Expert 100+
P: 280
Is RRP numeric or string?
If numeric then remove the single quotes

"SELECT Category, Description, Image, ProductRef, RRP, SalePrice FROM BOM WHERE Category = '" + Replace(Recordset1__MMColParam, "'", "''") + "' AND RRP < " + Replace(Recordset1__MMColParam2, "'", "''")


What datatype is Category
Apr 18 '07 #2

P: 5
thank you so much i cracked it! so simple in the end!

many thanks once more.

James
Apr 18 '07 #3

pks00
Expert 100+
P: 280
:)

no probs
Apr 18 '07 #4

P: 1
type missmatch is also removed by changinging number datatype to text data type bcz text datatype contain both text and number.

thanks
Mar 19 '12 #5

NeoPa
Expert Mod 15k+
P: 31,314
While that may be true at a very basic level, it is certainly not a solution to the problem of how to ensure the SQL correctly matches the type of the existing data.

See post #2 for where the correct answer has already been supplied.
Mar 19 '12 #6

Post your reply

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