我有两个表,一个表单和两个子表单。在表单中,我有搜索按钮,输出必须以两个子表单形式出现。只有成功打开1个子表单。另一个子表单不会改变任何内容。一切都以一种形式发生。问题是当我按下按钮搜索时,我如何制作,两个子表单出来我想要的输出。例如,我想搜索苹果。两个子表格会给我苹果。当然在这两张桌子上都有苹果。
Private Sub Command15_Click()
Dim mySiteID As String
mySiteID = "Select * from Access_FullSite where([Site ID] = '" & Me.Text27 & "')"
Me.Access_FullSite_subform.Form.RecordSource = mySiteID
Me.Access_FullSite_subform.Form.Requery
Dim mySiteID As String
mySiteID = "Select * from Access_FullSite where([Site ID] = '" & Me.Text27 & "')"
Me.Metro_CP_subform.Form.RecordSource = mySiteID
Me.Metro_CP_subform.Form.Requery
End Sub
感谢您的提前帮助
答案 0 :(得分:0)
根据你的不完整问题疯狂猜测,但我认为你所追求的是
Private Sub Command15_Click()
Dim mySiteID As String
mySiteID = "Select * from Access_FullSite where([Site ID] = '" & Me.Text27 & "')"
Me.Access_FullSite_subform.Form.RecordSource = mySiteID
Me.Access_FullSite_subform.Form.Requery
Me.Metro_CP_subform.Form.RecordSource = mySiteID
Me.Metro_CP_subform.Form.Requery
End Sub
您不需要重新声明(编译失败)或将变量设置为相同的值。