Vba 在Access记录集中随时比较Outlook

Vba 在Access记录集中随时比较Outlook,vba,ms-access,outlook,Vba,Ms Access,Outlook,我在Outlook文件夹中循环以返回接收时间大于表中最新数据的记录 代码适用于除一条记录之外的所有记录 If将其评估为真: olItms.Item(i).ReceivedTime>dDateTime 其中两个值均为:2019年6月19日14:21:55 Set rs=db.OpenRecordset(“从tbl_EngagementData中选择EmailTime,其中ReportID=“””和“缺勤”和“”,“按EmailTime说明订购”) dDateTime=rs.Fields(0) 对

我在Outlook文件夹中循环以返回接收时间大于表中最新数据的记录

代码适用于除一条记录之外的所有记录

If
将其评估为真:

olItms.Item(i).ReceivedTime>dDateTime
其中两个值均为:
2019年6月19日14:21:55

Set rs=db.OpenRecordset(“从tbl_EngagementData中选择EmailTime,其中ReportID=“””和“缺勤”和“”,“按EmailTime说明订购”)
dDateTime=rs.Fields(0)
对于i=olItms。计数为1步骤-1
如果olItms.Item(i).ReceivedTime>dDateTime,则
“做点什么
如果结束
下一个
我希望该记录的评估结果为假。

请尝试:

If DateDiff("s", dDateTime, olItms.Item(i).ReceivedTime) > 0 Then

我认为问题是在秒毫秒等部分。Access和Outlook可能具有不同的精度。将左右两侧转换为双面,看看你得到了什么。谢谢,效果很好。我怀疑这可能是个问题。