我在基于组合框尝试更改子表单记录时遇到ms访问错误
The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.
这里是我的代码
Private Sub Text4_AfterUpdate()
If (Me.Text4.Value = "(ALL)") Then
filterORIGIN_COD = "SELECT SUMMARY.DEST_CITY, SUMMARY.DESTINATION, Count(SUMMARY.CNOTE_NO) AS CountOfCNOTE_NO1" & _
"FROM SUMMARY" & _
"WHERE (((SUMMARY.ORIGIN_CODE) Like " & "'" * "'" & ")))" & _
"GROUP BY SUMMARY.DEST_CITY, SUMMARY.DESTINATION, SUMMARY.TGL_DATA, SUMMARY.ORIGIN_CODE, SUMMARY.ORIGIN, SUMMARY.DEST_CODE;"
Else
filterORIGIN_COD = "SELECT SUMMARY.DEST_CITY, SUMMARY.DESTINATION, Count(SUMMARY.CNOTE_NO) AS CountOfCNOTE_NO1" & _
"FROM SUMMARY" & _
"WHERE (((SUMMARY.ORIGIN_CODE)=" & """Me![Text4]""" & ")))" & _
"GROUP BY SUMMARY.DEST_CITY, SUMMARY.DESTINATION, SUMMARY.TGL_DATA, SUMMARY.ORIGIN_CODE, SUMMARY.ORIGIN, SUMMARY.DEST_CODE;"
End If
Me![OUTBOUND_DETAIL].Form.RecordSource = filterORIGIN_COD
Me![OUTBOUND_DETAIL].Requery
End Sub
其他 实际上,我试图过滤子表单(查询记录源),有人可以告诉我更好的方法吗? :)
答案 0 :(得分:0)
如果尝试在触发事件中过滤子表单,只需使用DoCmd.ApplyFilter或DoCmd.SetFilter (对于Access 2010 +)方法,这些方法也可用于宏:
VisitMethodCall