RunSQL for Update

Les Blair

Registered User.
Local time
Today, 05:35
Joined
Sep 10, 2007
Messages
49
Can someone please tell me where I went wrong with the following:

SQL = "UPDATE tblSoldCase " & _
"SET tblSoldCase.[Case Name] = tblProspect.[Case Name], tblSoldCase.[Admin Letter App/Decl] = tblProspect.[Admin Leffer App/Decl]" & _
"Where (((tblProspects.[Case Track Nbr]) = " & Me.txtCaseTrackNbr & "));"

DoCmd RunSQL SQL

I want run a update SQL
 
I sorry I left that out of the last thread.

Dim SQL As String
If (Me.txtSoldCase) = "Sold" Then

SQL = "UPDATE tblSoldCase " & _
"SET tblSoldCase.[Case Name] = tblProspect.[Case Name], tblSoldCase.[Admin Letter App/Decl] = tblProspect.[Admin Leffer App/Decl]" & _
"Where (((tblProspects.[Case Track Nbr]) = " & Me.txtCaseTrackNbr & "));"

DoCmd RunSQL SQL

'MsgBox "Sold Case Record exist for '" & Me.txtCaseTrackNbr & "'"

End If
 
You need to have a space between [Admin Leffer App/Decl] and the word WHERE.

I would put spaces between continuous lines at the beginnings.
Code:
SQL = "UPDATE tblSoldCase" & _
      " SET tblSoldCase.[Case Name] = tblProspect.[Case Name]," & _ 
      " tblSoldCase.[Admin Letter App/Decl] = tblProspect.[Admin Leffer App/Decl]" & _
      " Where (((tblProspects.[Case Track Nbr]) = " & Me.txtCaseTrackNbr & "));"

That way, I can easily see if I have left out a space.

^
 

Users who are viewing this thread

Back
Top Bottom