error message help

  • Thread starter Thread starter Karen
  • Start date Start date
K

Karen

please take a look at the following bit of code and see if you can find
what's wrong. i'm using access2003 on a win2000 machine.

i get a error 3464 that says data type mismatch in criteria expression.
when i choose debug the 'docmd.runsql sql2' line is highlighted.

dbo_imitmidx_sql.item_no is a text field, 15 characters.
me![item_no] is a text field that is filled in by a query.


Dim SQL2 As String
SQL2 = "Update dbo_imitmidx_sql SET upc_cd = " & varX & " where
dbo_imitmidx_sql.item_no = " & Me![item_no]
DoCmd.RunSQL SQL2



Thanks,
Karen
 
Since .item_no is a text field, it needs to be wrapped inside quotes. So the
last part of your sql should be:
dbo_imitmidx_sql.item_no = '" & Me![item_no] & "'"
It's hard to see here, but there's an apostrophe (single-quote) before the
double-quote and between the last two double-quotes.
 
YES!! That was it. I looked everywhere for the answer to this and it was
that simple. Now all I have to do is 'decorate' my forms and make a menu
form and I'm all done this project.

Thanks Mark.

Karen.


Mark said:
Since .item_no is a text field, it needs to be wrapped inside quotes. So the
last part of your sql should be:
dbo_imitmidx_sql.item_no = '" & Me![item_no] & "'"
It's hard to see here, but there's an apostrophe (single-quote) before the
double-quote and between the last two double-quotes.

Karen said:
please take a look at the following bit of code and see if you can find
what's wrong. i'm using access2003 on a win2000 machine.

i get a error 3464 that says data type mismatch in criteria expression.
when i choose debug the 'docmd.runsql sql2' line is highlighted.

dbo_imitmidx_sql.item_no is a text field, 15 characters.
me![item_no] is a text field that is filled in by a query.


Dim SQL2 As String
SQL2 = "Update dbo_imitmidx_sql SET upc_cd = " & varX & " where
dbo_imitmidx_sql.item_no = " & Me![item_no]
DoCmd.RunSQL SQL2



Thanks,
Karen
 

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

Back
Top