none
CurrentDB.Execute INSERT INTO syntax issue. RRS feed

  • Question

  • I keep getting a syntax issue with this statement.  I want the work UserName in the "Field" field and a TempVar named UserName in the TextVal field.

    CurrentDb.Execute "INSERT INTO LoginInfo (Field, TextVal) values('UserName', '" & TempVars("UserName").Value & ")"

    Please help

    Thursday, November 21, 2019 6:29 PM

Answers

  • You're missing the ' after the TempVar:

    CurrentDb.Execute "INSERT INTO LoginInfo (Field, TextVal) values('UserName', '" & TempVars("UserName").Value & "')"


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by cFolds Thursday, November 21, 2019 9:56 PM
    Thursday, November 21, 2019 7:14 PM

All replies

  • You're missing the ' after the TempVar:

    CurrentDb.Execute "INSERT INTO LoginInfo (Field, TextVal) values('UserName', '" & TempVars("UserName").Value & "')"


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by cFolds Thursday, November 21, 2019 9:56 PM
    Thursday, November 21, 2019 7:14 PM
  • Sharp eyes! Thank you
    Thursday, November 21, 2019 9:57 PM