Private Sub Form_Open(Cancel As Integer)
Me.Bathroom = Forms!frmBathrooms!ID
Me.txtBathInfo.Caption = "Bathroom Room Number: " &
DLookup("Room", "tblRooms", "ID = " &
DLookup("Room", "tblBathrooms", "ID = " & Me.Bathroom))
Me.RecordSource = "SELECT * FROM tblStalls WHERE Bathroom = " & Me.Bathroom
Me.Recordset.AddNew
End Sub
其中第 2 行Me.Bathroom = Forms!frmBathrooms!ID
正在触发错误。调试器说Me.Bathroom = 1, Forms!frmBathrooms!ID = 38
。基本上我试图自动使这个表单的浴室字段与 frmBathrooms 表单的 ID 匹配。“我”是浴室物品的一种形式;可以有很多项目。
这到底是怎么抛出错误?尽管搜索了大约一个小时,但我找不到任何东西。我理解这个消息,但不知道这怎么可能抛出它?
Item 表的浴室字段在表单的记录源等中。想法?