Hi,
I've attached a database that contains a form with a continuous subform. It all works fine. My issue is that I'm trying to stop the message that comes up when a record is deleted. I've used docmd.setwarnings false and docmd.setwarnings true and that works for the main form but the subform causes the Microsoft warning to populate. I realize I can set the user settings to not alert with action queries however since this database will be sold the user didn't want to have clients have to worry about changing settings in their version of access so I've been doing it in code. Is there a way to stop the MS warning from coming up with the subform?
Thanks,
Leesha
Warning Popup
-
- BronzeLounger
- Posts: 1495
- Joined: 05 Feb 2010, 22:25
Warning Popup
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78657
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Warning Popup
The If -- Else -- End If structure wasn't quite right. Try this version:
Code: Select all
Private Sub cmdDeleteRecord_Click()
'Checks to see that data has been selected
If IsNull(Me.ReferralName) Then
Me.lstRecommendations.SetFocus
MsgBox "Please double click the box to select the record to deleted."
Exit Sub
End If
If MsgBox("You are about to delete this information. Are you sure you want to make these changes?", vbYesNo) = vbYes Then
'enter code that should run if the answer is yes
DoCmd.SetWarnings False
RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Me.lstRecommendations.Requery
Me.txtPrintSubform.Requery
End If
End Sub
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1495
- Joined: 05 Feb 2010, 22:25
Re: Warning Popup
Thanks Hans!
Worked like a charm.
Alicia
Worked like a charm.
Alicia