Data Export

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to do an export by the action transferspreadsheet. Is there a
way to add the current date to the export name. For example "work022806".
Thanks!!
 
Create a query and call it: work022806
Then create a command button, name it: export2xls
Make sure to use transferspreadsheet in the Caption under format in the
button property.

Create an OnClick event procedure use the bellow
Use this

Private Sub export2xls _Click()
On Error Resume Next
If Me.RecordsetClone.RecordCount > 0 Then
DoCmd.OutputTo acOutputQuery, " work022806", acFormatXLS
Else
MsgBox "No Record to Show, Cancelled Operation"
Cancel = -1
End If

End Sub

If there is no data, you will get the above message; otherwise you will get
an output of your report, select a location and save it.

Best of luck,
 
If you are going to do this daily, you could do
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9
"YourTable","C:\Work" & Format(Date(),"mmddyy")

Change the C: to the appropriate directory
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top