|
一个主窗体:frm_PriceList,子窗体:frm_PriceListLine
主窗体recordsource:tbl_PriceListHeader
子窗体recordsource:SELECT [tbl_PriceListLine].[pll_prlID], [tbl_PriceListLine].[pll_ItemID], [tbl_PriceListLine].[pll_LineNo], [tbl_PriceListLine].[pll_ItemPckg], [tbl_PriceListLine].[pll_Price], [itm_NameL1] & " - " & [itm_NameL2] AS itm_Name FROM tbl_Item INNER JOIN tbl_PriceListLine ON [tbl_Item].[itm_ItemID]=[tbl_PriceListLine].[pll_ItemID] ORDER BY [tbl_PriceListLine].[pll_LineNo];
子窗体中用一个文本框searchbox和一个按钮search来进行筛选,如下:
Private Sub Search_Click()
Dim strSQL As String
DoCmd.ApplyFilter , "itm_Name like '*" & Me.searchbox & "*'"
Me.Refresh
End Sub
在子窗体中筛选成功
但在主窗体中引用了子窗体后因为筛选直接使用主窗体recordsource,其中不存在itm_Name故提示出错要求输入itm_name相关值。如何解决? |
|