N
NEWER USER
I have a subform on an Unbound form. I am running a Function from a command
button on my subform. I am getting a Syntax Error in my Update statement.
Can anyone tell me WHY?
Function QClose()
On Error GoTo QClose_Err
Dim sql As String
Dim strWhere As String
Dim strMsg As String
Dim frm As Form
With CodeContextObject
strWhere = "WHERE " & .Filter
End With
strMsg = "FILTERED records will be updated to Closed."
If (MsgBox(strMsg, 273, "Warning") <> 1) Then
'Update filtered records on subform
DoCmd.CancelEvent
Exit Function
End If
DoCmd.SetWarnings False
Set frm = Screen.ActiveControl.Parent
sql = "update " & frm.RecordSource & " set " & frm.RecordSource &
".ThreatStatus = 'Closed'" & strWhere
DoCmd.RunSQL sql
DoCmd.Requery
DoCmd.SetWarnings True
QClose_Exit:
Exit Function
QClose_Err:
MsgBox Err.Description
Resume QClose_Exit
End Function
button on my subform. I am getting a Syntax Error in my Update statement.
Can anyone tell me WHY?
Function QClose()
On Error GoTo QClose_Err
Dim sql As String
Dim strWhere As String
Dim strMsg As String
Dim frm As Form
With CodeContextObject
strWhere = "WHERE " & .Filter
End With
strMsg = "FILTERED records will be updated to Closed."
If (MsgBox(strMsg, 273, "Warning") <> 1) Then
'Update filtered records on subform
DoCmd.CancelEvent
Exit Function
End If
DoCmd.SetWarnings False
Set frm = Screen.ActiveControl.Parent
sql = "update " & frm.RecordSource & " set " & frm.RecordSource &
".ThreatStatus = 'Closed'" & strWhere
DoCmd.RunSQL sql
DoCmd.Requery
DoCmd.SetWarnings True
QClose_Exit:
Exit Function
QClose_Err:
MsgBox Err.Description
Resume QClose_Exit
End Function