0
votes

I am getting error in MS access 2003, Run Time Error 2465: Microsoft can't find the field '|' referred to in your expression.

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
What are the values of the variables when that happens?parakmiakos
Have you escaped your values variables? Try Replace(strFName,"'","''")kiks73

1 Answers

1
votes

I think that you forgot the " in the DCount condition:

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

Also try to escape your variables:

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 & "');"