2 queries in one exported workbook

D

Derek Wittman

Good afternoon,
I have 2 queries (qryActivityHeaderList and qryActivitySteps) that I want to
put on 2 separate sheets of my workbook. My workbook name should be dynamic,
based on the criteria entered by the user. I'd like the same criterion
(oper_id) to come from one user input for both sheet/exports.

The filename should be pointed to a path c:\slotting\ where the filename is
Operation-<oped_id>.xls and the tabs should be Header and Steps (if that's
at all possible without manipulating the workbook from within Access).

My code, so far, is this. And I get an error msg during the run that the
path doesn't exist. (and yet I know that it does).

Private Sub_DoStuff_Click()
Dim filenm As String
filenm = "c:\slotting\Operation-" & InputBox(OperationID) & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"qryActivityHeaderList", filenm, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"qryActivitySteps", filenm, True
End Sub

Any assistance would be greatly appreciated. I used to know how to do this,
but it's normally not part of my job. :) I'm a bit rusty. I'm in Access
2003. Thank you!

Derek
 

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