By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,680 Members | 1,500 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,680 IT Pros & Developers. It's quick & easy.

Export File Name

P: n/a
I have a macro that runs to export a report. It dumps a report on the
server in RTF format. Here's the problem that I am having. I would
like for the report to have a custom file name daily, like maybe the
date. I do not write VB code, so I'm reliant on Access macros. In the
export path, you type the path and file name so that the macro knows
where to dump the file. There is not a "build" option in this box.
Does anyone know a work around for me? Thanks in advance!

Jamie A. Landers
ja***********@yahoo.com
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Leave the parameter "Output File" blank. When the macro runs it will
prompt the user for a file name/location.

If you want the file name to automagically be created you'll have to
do it in VBA.

- --
MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP6FtooechKqOuFEgEQIbggCgqZIHhd13rRBZSrxhjOgKNc 5bFU0AoLhU
WMfaOoVCPO0RT2prtDPda/kS
=s6l6
-----END PGP SIGNATURE-----
Jamie A. Landers wrote:
I have a macro that runs to export a report. It dumps a report on the
server in RTF format. Here's the problem that I am having. I would
like for the report to have a custom file name daily, like maybe the
date. I do not write VB code, so I'm reliant on Access macros. In the
export path, you type the path and file name so that the macro knows
where to dump the file. There is not a "build" option in this box.
Does anyone know a work around for me? Thanks in advance!

Jamie A. Landers
ja***********@yahoo.com

Nov 12 '05 #2

P: n/a
A macro can't do this, but it is quite simple with a little code.
I assume you're doing this by clicking a button to run a macro

Instead of a macro, put this code under your button.
(the code assumes that your button has a name of Cmd_Export)

Private Sub Cmd_Export_Click()
On Error GoTo Err_Cmd_Export_Click

TheDate = Month(Date) & "-" & Day(Date) & "-" & Year(Date)
TheFile = "c:\temp\MyReport-" & TheDate & ".rtf"

DoCmd.OutputTo acReport, "MYReport", "RichTextFormat(*.rtf)", TheFile,
False, ""

TheMessage = "Report has been exported to " & TheFile

Beep
MsgBox TheMessage, vbInformation, "Report Complete"

Exit_Cmd_Export_Click:
Exit Sub

Err_Cmd_Export_Click:
MsgBox Err.Description
Resume Exit_Cmd_Export_Click

End Sub
Good Luck
"Jamie A. Landers" <ja***********@yahoo.com> wrote in message
news:aa**************************@posting.google.c om...
I have a macro that runs to export a report. It dumps a report on the
server in RTF format. Here's the problem that I am having. I would
like for the report to have a custom file name daily, like maybe the
date. I do not write VB code, so I'm reliant on Access macros. In the
export path, you type the path and file name so that the macro knows
where to dump the file. There is not a "build" option in this box.
Does anyone know a work around for me? Thanks in advance!

Jamie A. Landers
ja***********@yahoo.com

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.