In OutputTo, How can I name file using current date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Access question. In OutputTo (in a macro), How can I name the output file
using current date in the name (example: c:\reports\Sept122004.rtf)
 
Photoman,

Like this...
="C:\Reports\" & Format(Date(),"mmmddyyyy") & ".rtf"

Well, that will *almost* do it... it will be Sep122004.rtf. If you want
to abbreviate the month to Sept it is a bit more complicated, as the
native date formatting only supports a 3-character abbreviation.
 
Thanks, that worked, now here's an extension of that question:
How do I tell it to put the reports (in the \Reports directory) on whatever
drive the database is on (right now, I am keeping the database on a memory
pen so I can use it home and at the school I wrote it for). I would like the
output to go to the flash drive. At home, it's the E: drive, but at the
school, its' the D: drive.

Again, thanks for the original answer.

Vito
 
Vito,

I am not aware of any way of doing this in a macro. You would need to
identify the drive portion of the path via a VBA procedure using...
Left(CurrentDb.Name, 3)
.... so, the definition of the output file would become something like
this...
Left(CurrentDb.Name, 3) & "Reports\" & Format(Date(),"mmmddyyyy") & ".rtf"
 
Thanks anyway. I figured it out based on someone elses post about doing
something different. The coding woud be:
=CurrentProject.Path & "\Reports\" & Format(Date(),"mmmddyyyy") & ".rtf"

It was in response to a post about someone not wanting to start the
AutoViewer when they output to a snapshot format. I adapted what I
thought would work, and viola, it did.

Thanks again,
Vito
 
Back
Top