Les Blair
10-01-2007, 08:32 AM
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
ajetrumpet
10-01-2007, 08:37 AM
don't you need to Dim SQL first??
Les Blair
10-01-2007, 09:25 AM
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
ajetrumpet
10-01-2007, 10:42 AM
so what's happening when you run it?? nothing??
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.
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.
^
Les Blair
10-02-2007, 06:15 AM
Thank you that worked and helped