Todays date to Output Module... (1 Viewer)

HaroldIII

Registered User.
Local time
Today, 07:27
Joined
Feb 2, 2011
Messages
55
DoCmd.OutputTo acOutputQuery, "Exch_Compare", acFormatXLSX, "M:\Exceptions Research\OutPut\(NEED TODAYS DATE HERE)Exchange.xlsx", False

Hi-

I need to add todays date to the output file name. It needs to change every day (Today "3-8-2011Exchange.xlsx) then (tomorrow 3-9-2011Exchange.xlsx)

Its prob a simple code, but the Access Help is not giving me the right answer.:confused:

Thanks
 

DCrake

Remembered
Local time
Today, 12:27
Joined
Jun 8, 2005
Messages
8,632
Code:
DoCmd.OutputTo acOutputQuery, "Exch_Compare", acFormatXLSX, "M:\Exceptions Research\OutPut\" & Format(Date(),"dd-mm-yyyy") & "Exchange.xlsx", False
 

vbaInet

AWF VIP
Local time
Today, 12:27
Joined
Jan 22, 2010
Messages
26,374
To concatenate "Hello" to "World" you do "Hello" & "World".

The function for today's date is Date(). To format the date so that it uses hyphen as the delimeter you need the Format() function.

See what you can come up with.
 

HaroldIII

Registered User.
Local time
Today, 07:27
Joined
Feb 2, 2011
Messages
55
To concatenate "Hello" to "World" you do "Hello" & "World".

The function for today's date is Date(). To format the date so that it uses hyphen as the delimeter you need the Format() function.

See what you can come up with.

Accurate and discriptive. Thank you it works and i learned something!! :)
 

vbaInet

AWF VIP
Local time
Today, 12:27
Joined
Jan 22, 2010
Messages
26,374
Happy to hear you learnt something today HaroldIII :)
 

Users who are viewing this thread

Top Bottom