Microsoft Access "Overflow" Error on format

Status
Not open for further replies.
Part of the data my company handles has to run through an Access Database. Often when importing files we will import the fields as strings then format them into the correct data types so that we can see what the client is sending if we run into formatting errors.

One field is a date. We're converting it to a date using "Format([Expiration_Date], "MM/DD/YYYY"). Normally this works, but currently with the dates we're getting an "Overflow" error. Any help on what I might be doing wrong here?
 
I think what is actually occurring here is Access is implicitly casting the field to a date type, then applying the MM/DD/YYYY format to cast to a string, then implicitly casting back to a date in the final output. The implicit cast expects a specific format. In this case, I think you are going to have to manually cast the input string into a date (as MM/DD/YYYY) with some string functions.

But what should really be done here is to apply the data type transformations at time of import using import specifications (these allow for selecting different date formats) and/or using the convert functions (cdate, cint, clng, etc.)
 
Status
Not open for further replies.