我有以下代码行:
Me.Filter = "[SN] = '" & Me!AcftSN.Value & "'" & " and [Formdate] between "/
& Me!startdate.Value & " and " & Me!enddate.Value
返回以下字符串:
" [SN] =' 4A2'和[Formdate]在1/2/2005和2016年3月10日之间"
[SN]是文本,[Formdate]是日期
运行时,我收到一条没有记录的报告。这只适用于第一个标准(SN = 4A2),所以我认为'和'或者错误地读取日期值。有人可以帮助语法吗?
答案 0 :(得分:1)
将日期值格式化为字符串表达式:
Me.Filter = "[SN] = '" & Me!AcftSN.Value & "'" & " and [Formdate] between #" & Format(Me!startdate.Value, "yyyy\/mm\/dd") & "# and #" & Format(Me!enddate.Value, "yyyy\/mm\/dd") & "#"