如何在vba acces 2003中使用对话框是否 [英] how to use dialog box yes no in vba acces 2003
问题描述
我正在使用Access 2003表单和数据库.
我正在将记录保存在数据库中,并且可以正常工作.
我有一个按钮命令退出"以关闭表单,它正在与"docmd.close"一起使用.
我想在退出按钮上调用是/否对话框,以防表单中出现错误,并且用户可以单击退出按钮而不用更新按钮来更新数据.
如果已更新,则输入是/否"对话框后的数据将不计算在内,并且表格应关闭
请帮助我,在此先感谢
Hi,
I''m using access 2003 forms and database.
I am saving records in database and it is working.
I have a button command ''exit'' to close the form and it is working with "docmd.close".
I want to call yes/no dialog on exit buttonin case there are errors in the form and the user can click exit button without updating data with update button.
If it is updated, data after entry yes/no dialog should not count, and form should be closed
Please help me, thanks in advance
推荐答案
在DoCmd.Close语句之前,您可以插入
Before the DoCmd.Close statement, you could insert
If MsgBox("Do you want to save your changes?", vbYesNo Or vbQuestion) = vbYes Then
'' save the changes here
End If
在退出"按钮的点击"事件处理程序中.
in your "exit" button''s "click" event handler.
这篇关于如何在vba acces 2003中使用对话框是否的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!