Hello, I really need some help with this code
Private Sub Cmd_UpdateInfo_Click()
Dim iStr As String
iStr = "INSERT INTO Tbl_CorporateLicUpdate (CorpLicID,LastFilingDate,Expires,ProcessingDate,Renewed)"
iStr = iStr & "VALUES ("
iStr = iStr & "'" & Me.RecordID.Value & "' , #" & Date & "# , #" & Me.NewExp.Value & "# , #" & Me.NewProc.Value & "# , 0)"
DoCmd.RunSQL iStr
Dim uSQL As String
uSQL = "UPDATE Tbl_CorporateLicUpdate" & _
"SET Renewed=-1" & _
"WHERE CorpID = " & Me.RecordID & " AND ID = " & Me.ID & ""
DoCmd.RunSQL uSQL
End Sub
So the 1st portion works properly. It is inserting the new record.
The 2nd Portion gives me error code 3129 - Invalid SQL Statement
Previously I had
'DoCmd.RunSQL "UPDATE Tbl_CorporateLicUpdate SET Renewed= TRUE WHERE CorpLicID =" & Me.RecordID & " AND ID=" & Me.ID
But it say variable not yet created in this context. Anything I'm not seeing?
Thank you
Private Sub Cmd_UpdateInfo_Click()
Dim iStr As String
iStr = "INSERT INTO Tbl_CorporateLicUpdate (CorpLicID,LastFilingDate,Expires,ProcessingDate,Renewed)"
iStr = iStr & "VALUES ("
iStr = iStr & "'" & Me.RecordID.Value & "' , #" & Date & "# , #" & Me.NewExp.Value & "# , #" & Me.NewProc.Value & "# , 0)"
DoCmd.RunSQL iStr
Dim uSQL As String
uSQL = "UPDATE Tbl_CorporateLicUpdate" & _
"SET Renewed=-1" & _
"WHERE CorpID = " & Me.RecordID & " AND ID = " & Me.ID & ""
DoCmd.RunSQL uSQL
End Sub
So the 1st portion works properly. It is inserting the new record.
The 2nd Portion gives me error code 3129 - Invalid SQL Statement
Previously I had
'DoCmd.RunSQL "UPDATE Tbl_CorporateLicUpdate SET Renewed= TRUE WHERE CorpLicID =" & Me.RecordID & " AND ID=" & Me.ID
But it say variable not yet created in this context. Anything I'm not seeing?
Thank you
Last edited: