Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我被困在一个查询中,以将当前日期与以给定格式 7/25/2012 存储在访问数据库表中的日期进行比较
我正在使用这个查询:
Sql = "SELECT max(token_today) FROM token WHERE issue_date = #" & FormatDateTime(Now, DateFormat.ShortDate) & "#"
我收到以下错误:
从字符串 ** 到类型“整数”的转换无效。
请告诉我如何比较日期。谢谢你!
如果您想比较今天的日期,则无需外部参考:
Sql = "SELECT max(token_today) FROM token WHERE issue_date = Date()"
这也节省了语言环境的各种问题。
我认为这应该有效:
"SELECT max(token_today) FROM token WHERE issue_date = #" & FormatDateTime(Now,"YYYY/MM/DD") & "#"