VBA 没有 Return 正确的系统日期

VBA Does Not Return Correct System Date

我有一个程序,如果报告在那个日期还没有发出,就会发出报告。当它发送报告时,它将 运行 一个将日期和报告名称插入 table.

的查询

问题是它返回的日期是 2019 年 2 月 19 日。如果是格式问题我会理解,但这个日期完全不对。

Dim strFile As String
Dim strTo As String
Dim strSubject As String
Dim strBody As String
Dim InReport As String
Dim InDate As Date

strFile = Forms!frmMain!strFile
strTo = "email"
strSubject = "subject"
strBody = "body"
InReport = "ReportName"
InDate = Date

    If DCount("*", "tblEmailTracking", "[SentDate]=#" & InDate & "#") > 0 Then

    Exit Sub
        'do nothing
Else
        'send email
        
    DoCmd.OpenReport "ReportName", acViewPreview, , , acHidden
       Reports("ReportName").Caption = strFile
       
    DoCmd.SendObject acSendReport, "ReportName", acFormatPDF, strTo, strCC, , 
    strSubject, strBody, False
    DoCmd.RunSQL "INSERT INTO tblEmailTracking(SentDate, SentReport) VALUES('" & InDate & "', '" & InReport & "');"
    
    DoCmd.Close acReport, "ReportName"

End If

把工作留给SQL:

DoCmd.RunSQL "INSERT INTO tblEmailTracking(SentDate, SentReport) VALUES( Date(), '" & InReport & "');"