data mismatch

C

Carl

I'm getting the data mismatch error on a query. It delivers the data,
shows what I want then when I acknowledge the error it goes to
"name?".

The data looks like this:
field2 | field3
540120-690 | indirect labor


the query is right$([field2],3)="690"

Like I said the data shows ok then the error box shows up

Data type mismatch in criteria expression. (Error 3464)
The criteria expression in a Find method is attempting to compare a
field with a value whose data type does not match the field’s data
type.

field 2 is set as text in the table because of the hyphens, is this
wrong?
 
J

John Spencer MVP

Try using RIGHT instead of RIGHT$

If field2 is EVER NULL using RIGHT$ will cause a data mismatch error. RIGHT
will handle nulls correctly.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
J

John W. Vinson

I'm getting the data mismatch error on a query. It delivers the data,
shows what I want then when I acknowledge the error it goes to
"name?".

The data looks like this:
field2 | field3
540120-690 | indirect labor


the query is right$([field2],3)="690"

Like I said the data shows ok then the error box shows up

Data type mismatch in criteria expression. (Error 3464)
The criteria expression in a Find method is attempting to compare a
field with a value whose data type does not match the field’s data
type.

field 2 is set as text in the table because of the hyphens, is this
wrong?

It certainly should be Text. However what you post is not a query - just part
of one.

Please open the query in SQL view and post the SQL text here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top