本文介绍了请帮忙编写模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在使用MS Access 2000来设计一个小型数据库,它有五种形式。每个表单都有很少的子表单。为了安全起见,如果表单加载我保护如下: Private Sub Form_Load() Me.AllowEdits = False Me.AllowDeletions = False SCTP.Form_FormCounselingQ.AllowDeletions = False SCTP.Form_FormCounselingQ.AllowEdits = False SCTP.Form_FormAccomodationQ.AllowDeletions = False SCTP.Form_FormAccomodationQ.AllowEdits = False End Sub 然后,点击命令按钮I上的事件有以下代码可以编辑和删除数据: Private Sub Command153_Click() Me.AllowDeletions = True Me.AllowEdits = True SCTP.Form_FormCounselingQ.AllowDeletions = True SCTP.Form_FormCounselingQ.AllowEdits = True SCTP.Form_FormAccomodationQ.AllowDeletions = True SCTP.Form_FormAccomodationQ.AllowEdits = True End Sub 它运行正常,但我必须在所有代码中编写此代码形成一个nd所有按钮只是为了保护和取消保护。 任何人都可以帮我在模块中编写一次这段代码,然后只需将它调用以用于每种形式。 我非常感谢您对我的问题的回复。I am using MS Access 2000 to design a small database, which have five forms. Each form has few subform. For security, in the event of form load I protect as follow: Private Sub Form_Load()Me.AllowEdits = FalseMe.AllowDeletions = FalseSCTP.Form_FormCounselingQ.AllowDeletions = FalseSCTP.Form_FormCounselingQ.AllowEdits = FalseSCTP.Form_FormAccomodationQ.AllowDeletions = FalseSCTP.Form_FormAccomodationQ.AllowEdits = FalseEnd Sub Then, on the event on click of command button I have the code to enable editing and deleting data as follow: Private Sub Command153_Click()Me.AllowDeletions = TrueMe.AllowEdits = TrueSCTP.Form_FormCounselingQ.AllowDeletions = TrueSCTP.Form_FormCounselingQ.AllowEdits = TrueSCTP.Form_FormAccomodationQ.AllowDeletions = TrueSCTP.Form_FormAccomodationQ.AllowEdits = TrueEnd Sub It works fine, but I have to write this code in all forms and all buttons for just protect and unprotect. Can anyone out there help me to write this code one time in module, then just call it for use in each form. Your respond to my questions are highly appreciated.推荐答案 这样称呼 Call it like this 展开 | 选择 | Wrap | 行号 展开 | 选择 | Wrap | 行号 展开 | 选择 | Wrap | 行号 这篇关于请帮忙编写模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-28 11:05