Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to execute a message having 'Yes/No' Options? 2

Status
Not open for further replies.

kosala1981

Programmer
Apr 10, 2007
17
LK
I want to execute code, only when i click yes option of the message.
following is my code. here i try to delete a record and when i click 'Yes', the record should be deleted but the record deletes when i click 'No' as well.

Code:

If vbYes=6 Then 'both yes & no options delete records'

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

End If
 
vbYes=6 is ALWAYS true.
Your test should be like this:
reply = MsgBox(...)
If reply = vbYes Then
' delete record stuff
End If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
or
Code:
[blue]   If MsgBox(...) = vbYes Then
[green]      'delete records[/green]
   End If[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top