Dialogue box

P

Phil

Thanks in advance for any help i might get

i have a delete record button on a form i would like to change the code so
that when pressed the button would ask me if i would like to send an email to
the perosn concerned and obviously if i say yes the email will go but if i
say no it will go on to delete the record. i have no idea how to do this, i
have the code for the email i need to send i just need a statement for the
dialogue box and how to put it all together

i hope someone can help i appreciate all the help i have had from here in
the past

thanks

Phil
 
G

Graham R Seach

Phil,

If you want to send an email OR delete the record, use this:

If vbYes = MsgBox("Do you want to send an email?", _
vbYesNo + vbQuestion, "Send Email?") Then

'Code to send the email
Else
'Code to delete the record
End If

If you want to optionally send an email, but always delete the record, use
this:

If vbYes = MsgBox("Do you want to send an email?", _
vbYesNo + vbQuestion, "Send Email?") Then
'Send the email
End If

'Code to delete the record

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
P

Phil

Thanks that works great

Phil

Graham R Seach said:
Phil,

If you want to send an email OR delete the record, use this:

If vbYes = MsgBox("Do you want to send an email?", _
vbYesNo + vbQuestion, "Send Email?") Then

'Code to send the email
Else
'Code to delete the record
End If

If you want to optionally send an email, but always delete the record, use
this:

If vbYes = MsgBox("Do you want to send an email?", _
vbYesNo + vbQuestion, "Send Email?") Then
'Send the email
End If

'Code to delete the record

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Top