Data type mismatch in criteria expression

J

Jesse Aviles

I'm running a search database and have created a small form that searchs based on name an telephone
numbers. Everything was working fine with the old data. The old data was several years old and was
contained in Excel. When new data was added, the search form was not finding any of the new data.
Since names were not typed consistently, I created a query that combined all the name fields and
stripped them of spaces. I was left with a long string that was the base of the search. I have a
list box that shows the results of the search and that listbox has its RowSource set dynamically via
code and it references a query that contains the necessary fields and its alterations. If I open
the query, I see all the records from the table. If I run the search, I cant see the new records
added but I can still find the old records. If I go directly to the query and type the search
string in design view and then change to datasheet view, I receive a "Data Type mismatch in criteria
expression". I know there is no mismatch. I'm searching for a string in a text field {this text
field field is based on the following: Replace([Full]," ","",1) and full is based on [txtNombre] &
[txtSegNombre] & [txtApellido] & [txtSegApellido]} and I'm able to search succesfully on some
entries.

The query string is the following:
SELECT qryBusquedaPacientes.lngPacientesRec, qryBusquedaPacientes.Nombre,
qryBusquedaPacientes.txtTel, qryBusquedaPacientes.RFull FROM qryBusquedaPacientes WHERE RFull LIKE
'*matos*'

If I use everything but the WHERE clause, it runs fine. The WHERE clause makes it break and gives
the above error. All I know is that even if I force it to be a string by using CStr it will still
fail. Any help will be appreciated.
 

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