error message help

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
 
M

Mark

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.
 
K

Karen

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
 
Top