Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

export table/query with the filename set as current time

Status
Not open for further replies.

ApplePirate

Programmer
Dec 16, 2002
65
GB
basically i want to export a table/query from within access to a specified location, but have the filename set as the current date and time 01/01/01 00:00:00
the reason for this is that data will need to be exported on a regular basis throughout the day and i need the filenames to be both unique and concurrent...
is there a way for this to be done?
i have searched the forum but havent found anything that is specific to access any VB ive picked up and used i.e. strings to concatenate the location with the current time, but i keep getting an error telling me that the filename is invalid. i presume because a forward slash is used in the date.
any help very much appreciated
 
When you save the date part of the filename use the format..

eg. & Format(Date,"dd-mm-yy")

This gets round the problem of the /

There are two ways to write error-free programs; only the third one works.
 
Using a form and a commandbutton, type the following code for the click event,

docmd.OutputTo acOutputTable,"Tablename",acFormatxls,"c:\path\name\" & date & ".xls"

regards,



jason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top