Reputation: 85
In an Access form, I need to use the date output from a date picker field to be used to search for a file in a form. However, the default data format seems to only allow slashes. Although I know the date is being stored as a number in the database.
Put simply, I need Me.myDate
to output a legal file name structure, for example, yy-mm-dd
. Then I can concatenate that with my file name to search for myfilename_yy-mm-dd
I always get myfilename_yy/mm/dd
which is of course unusable as a file name.
Changing the format of the field obviously makes no difference to how the value is stored. What I don't understand is if the date is stored as a number, and the output is shown in the selected format, how I can override the default formatting behaviour used when I query the date.
Upvotes: 1
Views: 398
Reputation: 97101
The Format Function will allow you to format the date as you wish.
An expression to include the formatted date in a filename pattern could look like this ...
"myfilename_" & Format(Me.myDate, "yy-mm-dd") & "*"
Upvotes: 3