E
Emma Aumack
Hello all,
Trying to code a "clear" flag field button on a form using Update SQL
statement. Please see the following code:
Private Sub btn_ClFlag_Click()
On Error GoTo Err_btn_ClFlag_Click
Dim strSQL As String
Dim flgFieldNo As String
Dim txtFlgfield As String
flgFieldNo = InputBox("Enter Flag #:", "Flag Field")
txtFlgfield = InputBox("Enter Flag Criteria to be Cleared. i.e.",
"Clear Flag" & flgFieldNo)
If Me.Dirty Then
Me.Dirty = False
End If
strSQL = "UPDATE Tbl_Contacts SET Tbl_Contacts.Flag" & _
flgFieldNo & "WHERE ((Tbl_Contacts.Flag" & flgFieldNo & ") = " &
txtFlgfield & ");"
DBEngine(0)(0).Execute strSQL, dbFailOnError
Me.Requery
Exit_btn_ClFlag_Click:
Exit Sub
Err_btn_ClFlag_Click:
msgbox Err.Description
Resume Exit_btn_ClFlag_Click
End Sub
Can someone tell me what is wrong with the SQL statement? Maybe quotes in
the wrong place?
Trying to code a "clear" flag field button on a form using Update SQL
statement. Please see the following code:
Private Sub btn_ClFlag_Click()
On Error GoTo Err_btn_ClFlag_Click
Dim strSQL As String
Dim flgFieldNo As String
Dim txtFlgfield As String
flgFieldNo = InputBox("Enter Flag #:", "Flag Field")
txtFlgfield = InputBox("Enter Flag Criteria to be Cleared. i.e.",
"Clear Flag" & flgFieldNo)
If Me.Dirty Then
Me.Dirty = False
End If
strSQL = "UPDATE Tbl_Contacts SET Tbl_Contacts.Flag" & _
flgFieldNo & "WHERE ((Tbl_Contacts.Flag" & flgFieldNo & ") = " &
txtFlgfield & ");"
DBEngine(0)(0).Execute strSQL, dbFailOnError
Me.Requery
Exit_btn_ClFlag_Click:
Exit Sub
Err_btn_ClFlag_Click:
msgbox Err.Description
Resume Exit_btn_ClFlag_Click
End Sub
Can someone tell me what is wrong with the SQL statement? Maybe quotes in
the wrong place?