在MS Access中的表单之间传递参数 [英] Passing parameters between forms in MS Access
本文介绍了在MS Access中的表单之间传递参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个名为login的登录表单,其中用户名被输入到txtEmployee文本框中,并且我需要在MS Access中的另一个表单中的第二页中显示相同的内容。
I have created a login form named login where the username is typed into the txtEmployee textbox, and I need to display the same in the second page in another form in MS Access.
推荐答案
DoCmd.OpenForm
允许您传递任意值作为最后一个参数。该值可以在新窗体中以 Me.OpenArgs
:
' Invoked by some Button on the first form '
Sub GoToSecondPage()
DoCmd.OpenForm "MySecondPage", acNormal, , , , , txtEmployee.Value
End Sub
' Second form '
Sub Form_Open(Cancel As Integer)
If Not IsNull(Me.OpenArgs) Then
lblShowEmployeeName.Value = Me.OpenArgs
End If
End Sub
<代码示例未经测试。)
(Code example untested.)
这篇关于在MS Access中的表单之间传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文