Share via

save file with date as name

Anonymous
2011-03-23T17:14:00+00:00

I have an Access database that runs a macro to output data to various files that I distribute to information users.  I would like to have the current date, or a date that is stored in a table, automatically be added as part of the file name when the macro runs.  Is this possible?  Currently I have to manually rename each file, which is a hassle and waste of time.

Thanks for any assistance you can provide.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2011-03-23T18:48:42+00:00

    or system date

    ="C:" & date() & "RestofDocName.fileextension"

    Don't forget you need to format the Date() or else it will give you an invalid file name error because of the slashes.

    ="C:" & Format(Date(), "yyyymmdd") & "RestOfDocName.fileExtension"

    4 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2011-03-23T18:14:25+00:00

    i assume since it is a macro you are using OutpuyTo, for the 'Output File':

    i'm sure you can pull it from a table depending on your setup, this asumes the recorddate you want is on an open form:

    ="C:" & [Forms]![My Form]![RecordDate] & "RestofDocName.fileextension"

    or system date

    ="C:" & date() & "RestofDocName.fileextension"

    1 person found this answer helpful.
    0 comments No comments