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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transfer data from Access to Excel

Status
Not open for further replies.

JcTon

MIS
Oct 26, 2007
16
US
Keep getting syntax error upon trying to run the following.

Any clue as to what I am missing?



Option Explicit
Option Compare Database
Private Sub TransferToExcel()
On Error GoTo Err_TransferToExcel

Dim query As String
Dim file As String

query = "qryFindAllEligDates"
file = "C:\Test\Adhoc\RptOct.xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, query, file, True
Exit_TransferToExcel():
Exit Sub
Err_ TransferToExcel():
MsgBox Err.Description
Resume Exit_TransferToExcel
End Sub
 
You should not have bbrackets or spaces in your labels:

Exit_TransferToExcel:

Err_TransferToExcel:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top