传递参数以形成被打开 [英] pass parameters to form being opened

查看:59
本文介绍了传递参数以形成被打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码单击Activities_Subform中的一个字段,打开Task_Subform,并将相关记录打开到Activities_Subform中的特定字段。


表单打开正常,但仅限如果我输入两个参数(objID和actID),任何人都可以告诉我代码是什么,以消除每次都要输入参数。


私有子ActivityID_Click()

Dim objID As Integer

Dim actID As Integer


objID = ObjectiveID.Value

actID = ActivityID .Value


DoCmd.OpenForm" Tasks_Subform",,,""


End Sub

I am using the following code to click on a field in Activities_Subform to open the Task_Subform with the related records to the particular field in Activities_Subform.

the form opens ok, but only if I put in two parameters (objID and actID), can anyone tell me what the code is to eliminate having to put in the parameters each time.

Private Sub ActivityID_Click()
Dim objID As Integer
Dim actID As Integer

objID = ObjectiveID.Value
actID = ActivityID.Value

DoCmd.OpenForm "Tasks_Subform", , , ""


End Sub

推荐答案

我认为您需要做的就是在openform命令中添加where语句

试一试:

I think all you need to do is add a where statement to your openform command
Give this a try:

展开 | 选择 | Wrap | 行号


您好


谢谢,我输入了该代码我得到一个运行时错误13(类型不匹配)


任何解决方案??
Hi

Thanks, I put in that code and I get a runtime error 13 (Type Mismatch)

Any solutions??


对不起,你只需要添加As String即可。到行Dim strLinkCriteria

这是我的错误,对不起。
Yes sorry you just need to add "As String" to the line "Dim strLinkCriteria"
That was my mistake sorry about that.


这篇关于传递参数以形成被打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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