I have a textbox on a form which contains the follow:
"UPDATE Dialogs SET Dialogs.Message = 'blah blah' " & vbCrLf & _
"WHERE (((Dialogs.Error)=1));"
Now I want to execute by doing the following:
Const strcLineEnd = " "" & vbCrLf & _" & vbCrLf & """"
If IsNull(Me.SQLStatement) & Me.txtqrytype = "UPDATE" Then
Beep
Else
strSQL = Me.SQLStatement
strSQL = Replace(strSQL, """", """""") 'Double up any quotes.
strSQL = Replace(strSQL, vbCrLf, strcLineEnd)
strSQL = """" & strSQL & """"
Me.txtVBA = strSQL
Me.txtVBA.SetFocus
Dim coded As String
coded = Me.txtVBA
DoCmd.RunSQL coded
End If
but I get the following error: invalid sql statement expected 'Delete', 'Insert', 'Select', Update'.
any ideas?