Warning Massage

T

Tom

Hi All,

Here is what I wrote:

Dim Msg As String, Style, Title, Response
Msg = "You are about to delete this record from the list, continue?"
Style = vbOKCancel
Title = "Delete Record"
Response = MsgBox(Msg, Style, Title)
If Response = vbOK Then
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings False
End If
and still I get access massage that I`m about to delete a record.

Thnaks,
Tom
 
S

Steve Schapel

Tom,

You've got the SetWarnings in the wrong place. I would do it like this...

If MsgBox("You are about to delete this record from the list,
continue?", vbYesNo, "Delete Record") = vbYes Then
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
End If
 
T

Tom

ooops, Thanks

Steve Schapel said:
Tom,

You've got the SetWarnings in the wrong place. I would do it like this...

If MsgBox("You are about to delete this record from the list, continue?",
vbYesNo, "Delete Record") = vbYes Then
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top