Sub cmboCompanyName_AfterUpdate()
Dim strNewRecord As String strNewRecord = "SELECT * FROM Customers " & " WHERE CustomerID = '" & Me!cmboCompanyName.Value & "'"
Me.RecordSource = strNewRecord
End Sub
-----------------------------
上述示例是将指定窗体的数据源,如果指定报表或子报表的数据源,要如何修改呢?
在窗体中输入上述代码,错误为:你在表达式中输入报表名称"多行报表"或引用的报表未打开
Dim strNewRecord As String
strNewRecord = "SELECT * FROM 报表 " & " WHERE ID = '" & Me.ID & "'"
Reports("多行报表").多行报表子表.Report.RecordSource = strNewRecord