我一直在试图创建一个搜索,用户指定的日期位于该记录的开始和结束日期之间的所有记录。我还希望用户能够通过“属性”将其拉起,除非它们保留空白。执行搜索用户输入日期落在两个日期之间
我是很新的VBA在昨天开始,这是我能想出的最新版本:
Private Sub Command4_Click()
Dim strFilter As String
strFilter = [Start_Date] <= Format(Me.RateDate, "Short Date") _
And [End_Date] >= Format(Me.RateDate, "Short Date")
If Not IsNull(Me.Property) Then
strFilter = strFilter & " AND [Num_Code] = '" & Me.Property & "'"
End If
DoCmd.OpenReport "rpt_RatesAll", acViewPreview, , strFilter
End Sub
最近发生的错误消息返回:运行时错误“2465”:微软访问无法找到您的表达式中引用的“| 1”。
任何帮助将不胜感激!
看看[this](http://www.access-programmers.co.uk/forums/showthread.php?t=184554)线程可以帮助你。提示:你有'strFilter'作为'String',但没有格式化你的输入。 – 2014-10-10 20:30:47