我使用以下代码单击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.
更多推荐
传递参数以形成被打开
发布评论