A
Angi
I have a msgbox that asks the user to confirm deleting records. If the
user presses cancel, I want to set each checkbox back to No. I've
tried .requery, .repaint, if...then. Nothing has worked. I think I
need something like a For each...then. I've looked at the help and
can't find anything on that. I'm also getting an error that I can't
assign a value to me.cDelete. TIA Here's my code now:
Private Sub Form_Close()
Dim msgboxresult As String
msgboxresult = MsgBox("You are about to delete contacts. Are
you sure you want to continue?", vbOKCancel, "WARNING!")
If msgboxresult = vbOK Then
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE Contactmain.*, contactmain.cdelete " _
& "FROM contactmain WHERE (((contactmain.cdelete)=True));"
Forms!companymain.Requery
DoCmd.SetWarnings True
End If
If msgboxresult = vbCancel Then
If Me.CDelete = yes Then
Me.CDelete = no
End If
End If
End Sub
user presses cancel, I want to set each checkbox back to No. I've
tried .requery, .repaint, if...then. Nothing has worked. I think I
need something like a For each...then. I've looked at the help and
can't find anything on that. I'm also getting an error that I can't
assign a value to me.cDelete. TIA Here's my code now:
Private Sub Form_Close()
Dim msgboxresult As String
msgboxresult = MsgBox("You are about to delete contacts. Are
you sure you want to continue?", vbOKCancel, "WARNING!")
If msgboxresult = vbOK Then
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE Contactmain.*, contactmain.cdelete " _
& "FROM contactmain WHERE (((contactmain.cdelete)=True));"
Forms!companymain.Requery
DoCmd.SetWarnings True
End If
If msgboxresult = vbCancel Then
If Me.CDelete = yes Then
Me.CDelete = no
End If
End If
End Sub