Creating multiple spreadsheets from form in access.

A

AJ

I have a form in which I have a list and a button. On clicking the button and
making a selection from the list box, it imports all the data corresponding
to the selection and transfers the records into a spreadsheet. This is the
code:
Private Sub Create_Report_by_Mandate_Manager_Click()
On Error GoTo Err_Create_Report_by_Mandate_Manager_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Summary Report - Incompleted Mandates"

stLinkCriteria = "[Sr Mgr / Mgr]=" & "'" & Me![List0] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, stDocName,
"C:\IncMandates\Mandates - " & CStr([List0]) & ".xls", True

Exit_Create_Report_by_Mandate_Manager_Cl:
Exit Sub

Err_Create_Report_by_Mandate_Manager_Click:
MsgBox Err.Description
Resume Exit_Create_Report_by_Mandate_Manager_Cl

End Sub

Now how do I generate a separate spreadsheet for every entry in the list by
one click of the button.
thanks.
 

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