Error Executing Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • robertGreen613
    New Member
    • Sep 2007
    • 2

    Error Executing Query

    Hi All,

    I am trying to execute a query in my VB Code for this Access application. THe code i have is:

    Dim dbcon227 As Database
    Dim qryDeff As QueryDef
    Dim dbrs2, rs As Recordset
    Dim strSQL As String


    strSQL = "Update [Contract Line Items] set CONTRACTNO = tmpContractNo where CONTRACTNO = oldContractNo"
    Set dbcon227 = CurrentDb
    Set qryDeff = dbcon227.Create QueryDef("", strSQL)
    CurrentDb.Execu te (strSQL) <<<--- this is where it breaks!!!

    Any suggestions?

    Thanks!
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You need to frame the query properly.

    Comment

    • robertGreen613
      New Member
      • Sep 2007
      • 2

      #3
      I fixed it already! Seems Access looks for ' ' around the values.

      i.e., this code worked
      "UPDATE [Contract Line Items] set CONTRACTNO = '" + tmpContractNo + "' where CONTRACTNO = '" + oldContractNo + "'"

      Comment

      Working...