Hello, I am processing a file from another application.
All is going well except the date comparison within my application (ActivityDate as Date/Time with an input mask of 99/99/0000;0;_).
The date field in the incoming file is text: "20170128". It will always be 8 digits.
I want to convert this date to #01/28/2017# so I can compare ActivityDate to the incoming date.
I run a query that calls the function below to convert the incoming date to a standard Access date. In a second query each date is in a different table. I join the two tables on the dates .
I have created a subroutine to do the conversion. The converted date looks correct but I receive a Mismatch error when comparing the dates in the query.
Here is the code in a function:
I split the incoming field into century / month / day
DtDate as Date
VarDate = DateSerial(VarCentury, VarMonth, VarDay)
If IsDate(VarDate) Then
DtDate = VarDate
ConvertCenturyMonthDayToStandardDateFunction = DtDate
Else
Error
The code never goes to Error.
Thanks for help.
Bill
All is going well except the date comparison within my application (ActivityDate as Date/Time with an input mask of 99/99/0000;0;_).
The date field in the incoming file is text: "20170128". It will always be 8 digits.
I want to convert this date to #01/28/2017# so I can compare ActivityDate to the incoming date.
I run a query that calls the function below to convert the incoming date to a standard Access date. In a second query each date is in a different table. I join the two tables on the dates .
I have created a subroutine to do the conversion. The converted date looks correct but I receive a Mismatch error when comparing the dates in the query.
Here is the code in a function:
I split the incoming field into century / month / day
DtDate as Date
VarDate = DateSerial(VarCentury, VarMonth, VarDay)
If IsDate(VarDate) Then
DtDate = VarDate
ConvertCenturyMonthDayToStandardDateFunction = DtDate
Else
Error
The code never goes to Error.
Thanks for help.
Bill