在 MS Access 中的表单之间传递参数 [英] Passing parameters between forms in MS Access

查看:21
本文介绍了在 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆