dmcafee at pacbell.net
dmcafee at pacbell.net
Thu Dec 16 21:07:58 CST 2004
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