简体   繁体   English

以连续形式打开基于按钮的指定表单

[英]Open a specified form based on a button in a continuous form

I have a continuous form with a button for each record, I want that button to open another form with a specified WHERE clause (ID = "123").我有一个连续的表单,每个记录都有一个按钮,我希望该按钮打开另一个带有指定 WHERE 子句(ID =“123”)的表单。

edit : I figured out that the ID still pulls until I start querying data from another table.编辑:我发现在我开始从另一个表中查询数据之前,ID 仍然会被拉取。 So I can use the table where the ID lives but if I add in another table, the TaskID value becomes Null.所以我可以使用 ID 所在的表,但如果我添加到另一个表中,TaskID 值变为 Null。 Any ideas?有任何想法吗?

Here is the code:这是代码:

Private Sub btnOpenForm_Click()
On Error GoTo btnOpenForm_Click_Err
Dim strWhere As String

'Assigns TaskID from continuous form
strWhere = "[TaskID] = " & Me.[TaskID]    

DoCmd.OpenForm "frmDBAFix", , , strWhere

btnOpenForm_Click_Exit:
Exit Sub
btnOpenForm_Click_Err:
MsgBox Error$
Resume btnOpenForm_Click_Exit

End Sub

Data from the first table was appearing as null because the tables were linked via foreign key and the 2nd table had no data.第一个表中的数据显示为空,因为这些表是通过外键链接的,而第二个表没有数据。

Not sure why it even prevent textfields from appearing but... i'll leave it alone.不知道为什么它甚至会阻止文本字段出现,但是......我会不理会它。

Thanks谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM