运行时错误2465

时间:2014-11-27 14:43:47

标签: vba ms-access access-vba ms-access-2003

我在MS access 2003中遇到错误,运行时错误2465:Microsoft无法找到字段“|”在你的表达中提到。

Count = DCount("*", "PREPAYMENT_PRICING_CHANGE", ([INSERT_DATE] - Int([INSERT_DATE])) = ([Now()] - Int([Now()])))
db.Execute "INSERT INTO tbl_audit ([FilePath],[FileName],[action],[trans_date],[button],[number_of_records])" _
       & " values ( '" & strFName & "', '" & File & "'  , ""'Import_of_NTS_rate_PCD_file'""  ,Now() ,""'Import NTS rates from file'"",'" & Count & "');"

1 个答案:

答案 0 :(得分:1)

我认为您忘记了"条件中的DCount

Count = DCount("*", "PREPAYMENT_PRICING_CHANGE", "([INSERT_DATE] - Int([INSERT_DATE])) = ([Now()] - Int([Now()]))")

还尝试转义变量:

db.Execute "INSERT INTO tbl_audit ([FilePath],[FileName],[action],[trans_date],[button],[number_of_records])" _
       & " values ( '" & Replace(strFName,"'","''") & "', '" & Replace(File,"'","''") & "'  , ""'Import_of_NTS_rate_PCD_file'""  ,Now() ,""'Import NTS rates from file'"",'" & Count & "');"