By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,398 Members | 1,266 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,398 IT Pros & Developers. It's quick & easy.

Auto Export database into Excel with specific time

P: 17
Hello,

Is there a function in access that I can use to export my report into excel files automatically (like every day) without hitting any key or command?

Thanks for your help in advance.

Cheers
Aug 12 '07 #1
Share this Question
Share on Google+
1 Reply


BradHodge
Expert 100+
P: 166
Is there a function in access that I can use to export my report into excel files automatically (like every day) without hitting any key or command?
As long as your database is open and being used at the time that you want the export to occur, you could use something like this...
Expand|Select|Wrap|Line Numbers
  1. Private Sub MyField_Enter()
  2. Dim strDate as string
  3. strDate=Date
  4. If (Time() > "12:00:00 PM" And Time() < "12:15:00 PM") Then
  5. DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "tblMain", "C:\Export" & strDate & ".xls", True
  6. End If
  7. End Sub
This assumes that there is a form and field that are used often, that you know that they would be on this form during that block of time specified.

You would probably also need to check to see if the file exists so that you don't end up exporting several files a day :)

Good Luck!
Aug 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.