Pop Up Forms Question.

SpiritedAway

Registered User.
Local time
Today, 07:29
Joined
Sep 17, 2009
Messages
97
Hi,

I have a continuous form with a delete button for each record - however when the user hits delete - I want a pop up message to appear with something like 'you are about to delete this record are you sure?' - If the user presses "yes" - pop up message disappears and the record gets deleted. - if "no" simply gets rid of pop up message.

Can anyone advice on code on how this could be done - i'm sure its logical enough but I've got a block.

Thanks all for your assistance.
 
Where UniqueField is a field that identifies the record to be deleted to the user
Code:
Private Sub DeleteRecord_Click()
 Dim Msg, Style, Title, Response
 
 Msg = "Delete the Record for " & Me.UniqueField & "?"
 Style = vbYesNo + vbCritical
 Title = "Delete Selected Record"   

 Response = MsgBox(Msg, Style, Title)
 
 If Response = vbYes Then
  DoCmd.SetWarnings False
  DoCmd.RunCommand acCmdDeleteRecord
  DoCmd.SetWarnings True
 End If

End Sub

BTW, you're referring to a Messagebox here, not a Popup Form, which is something else altogether. The function to call one is the Msgbox() used above.

Linq ;0)>
 
Last edited:
Thanks missingling for your help,

I'm going to give it a try now.
 

Users who are viewing this thread

Back
Top Bottom