Darren DICK
d.dick at uws.edu.au
Thu Dec 16 21:19:31 CST 2004
Thanks David But I am not dealing with any dB objects at all In the old days of dos I would type ren c:\autoexec.bat autoexec.bak To rename the Autoexec to a backup file name Nothing to do with Access objects ieTables, forms, module etc. Any suggestions?? Darren -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of dmcafee at pacbell.net Sent: Friday, 17 December 2004 2:08 PM To: Access Developers discussion and problem solving Subject: RE: [AccessD] A2003: rename a file via vba this is what I do when exporting a query to Excel (The same would apply to renaming an mdb. Dim Path As String Dim stDocName As String Dim FileName As String Path = "C:\YourPathHere\" stDocName = "qryYourQueryNameHere" FileName = Format(Forms![MonthlyReport]![StartDate], "yyyymmdd") & "MonthlyReport.xls" If PathExists(Path) = False Then MkDir Path DoCmd.OutputTo acOutputQuery, stDocName, acFormatXLS, Path & FileName You could also use now if you want to use the current date instead of selecting a date from a form: FileName = Format(Now(), "yyyymmdd") & "MonthlyReport.xls" HTH David McAfee -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Darren DICK Sent: Thursday, December 16, 2004 5:40 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] A2003: rename a file via vba Hello all Any suggestion on renaming a file via code PSEUDO CODE EXAMPLE Some thing like Call Rename "C:\mydB.mdb", "C:\mydb" & "_" & Format(Date,"dd/mm/yyyy") & ".mdb" Many thanks Darren -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com