I am executing a SQL statement that is trying to update the value of a column while looping through a recordset. The statement should only update the value of the column for the record that it is currently working with and not the entire column. To do this I compare the value of the primary key, which I write into a variable at the beginning of each loop, with the primary key itself. I get a "Runtime Error '13' Type Mismatch" but I don't know why.
The pallettagnumber is the primary key which I also put into the "key" variable.
The key variable is dimensioned as integer, the column I am updating is a type: number. If I execute the statement from a query window, it works fine so the problem must be in the way it is handling the "key" variable but I don't know what is wrong. Thanks for any help!
DoCmd.RunSQL "UPDATE PalletImport SET ImportDate='1' WHERE pallettagnumber=" + key + ";"