Linking three queries to Excel File

T

Tamer

Hi all,
I'm trying to link 3 Access queries to 3 worksheets in an
Excel file. I used the following code in an event click in
a form, the code doesn't return any error, but it doesn't
establish the link as well. What am I missing?
Thanks in advance.

Dim strFileSpec As String
strFileSpec = "M:\Excel Files\SusanFiles.xls"

DoCmd.TransferSpreadsheet acLink, _
acSpreadsheetTypeExcel9,"qry_SuzanFiles_Adoption", _
strFileSpec, True, "Sheet1!"

DoCmd.TransferSpreadsheet acLink, _
acSpreadsheetTypeExcel9, "qry_SuzanFiles_Discharged+Age",_
strFileSpec, True, "Sheet2!"

DoCmd.TransferSpreadsheet acLink,
acSpreadsheetTypeExcel9, "qry_SuzanFiles_FP", _
strFileSpec, True, "Sheet3!"
 

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

Top