View Full Version : Output To question


Emmanuel
09-09-2005, 08:25 AM
Hey guys,

I have a macro that both opens and updates a query and then does an output to command which exports a table previously created on an excel format.

Here is the hard part. I need the macro to run every day and export the file but without overriding the previous one. Therefore I need the file name to contain the date within the name so each one will be unique. Any suggestions? I could even try it in the query or do an update query if you guys have another way other that the macro.

Thanks in advance for your help.

Emmanuel

reclusivemonkey
10-03-2005, 07:49 AM
Erm, add the date to the name in VBA? I think you answered your own question there.

Emmanuel
10-03-2005, 08:26 AM
reclusivemonkey,

I believe I did not as far as a way of doing it automatically. Now on the other hand I need to thank SMatthews for his help in comming around with the solution found below for your benefit:


Function Macro1()

Dim strdate as String

strdate = format$(date, "mmddyy")

DoCmd.SetWarnings False
DoCmd.OutputTo acQuery, "Converters Without Matching Remotes", "MicrosoftExcelBiff8(*.xls)", "\\Tbhilfs1\tbhildfs1\TB-HIL\Scripting\Manny\test" & strdate & ".xls", False, "", 0
DoCmd.SetWarnings True

End Function




Best Regards,

Emmanuel

reclusivemonkey
10-03-2005, 08:47 AM
For my benefit? I already know how to do this, thats why I was attempting to help :-) I failed to see the reply by SMatthews?