Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    57

    Unanswered: problem with DOcmd.runsql statement

    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 + ";"

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    DoCmd.RunSQL "UPDATE PalletImport SET ImportDate=1 WHERE pallettagnumber=" + key + ";"
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •