3464 - Data Type Mismatch in criteria expression

G

Guest

I use DAO for accessing a database. Aliases table includes [Alias], MEMO
field. For searching for a value I use FindFirst. In Office 2000 I receive
the error 3464, while in the rest of office versions is ok. What can be a
solution ?

Set db_table = db.OpenRecordset("aliases", dbOpenDynaset)

db_table.FindFirst ("Alias = " & """" & Trim(vnp_field_value) & """")
 
A

Allen Browne

You used a variable named db_table.
Access already has a constant with that name.

Try:
Dim rs As DAO.Recordset
Dim strWhere As String
Set rs = db.OpenRecordset("aliases", dbOpenDynaset)
strWhere = "Alias = " & """" & Trim(vnp_field_value) & """"
rs.FindFirst strWhere
 
G

Guest

Thanks Allen for your message. In my code I have different variable for
db_table. The error appears on the line below. It's not the variable for
table because I changed ALIAS to another field and it works ok. The problem
is with the MEMO field.

db_ALS_table1.FindFirst ("Alias = " & """" & Trim(vnp_field_value) & """")
 
G

Guest

Unfortunately I found the problem. I made a test with a new MEMO field called
Alias1 and it works ok. It seems that Alias field name for 2000 is a reserved
word. The problem now is that I cannot change it. Users will have to live
with it.

db_ALS_table1.FindFirst ("Alias1 = " & """" & Trim(vnp_field_value) &
"""")
 
A

Allen Browne

You must might get away with it if you add square brackets around the name.

Alternatively, you could create a query, and alias the field, e.g.:
SELECT Table2.[Alias] AS Alias2, ...
 
G

Guest

Yes, I could replace all calls for opening Aliases table to a query where it
aliases the field. Thanks a lot, I will try it!.
 

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