code help exporting to Excel
- From: "corkster" <donotspam12345@xxxxxxxxxxx>
- Date: 12 Oct 2006 13:07:38 -0700
Currently I am able to export to Excel all the coordinators each to
their own workbook and export the employees that are associated with
those coordinators within that workbook (the code below does this, John
Nurick was a big help with this code). What I would like is for the
employees to be exported to separate work***/tab within the workbook
for that coordinator instead of all in one work***.
Anyone have suggestions.
Dim strSQL As String
Dim dbD As DAO.Database
Dim qdfExport As DAO.QueryDef
Dim rscoordinator As DAO.Recordset
Dim strFileSpec As String
Set dbD = CurrentDb()
Set qdfExport = dbD.QueryDefs("Query3")
Set rscoordinator = dbD.OpenRecordset("Query4", dbOpenSnapshot)
Do Until rscoordinator.EOF
qdfExport.SQL = "SELECT * FROM Table2 WHERE [coordinator]=""" &
rscoordinator.Fields("coordinator").Value & " "";"
strFileSpec = "C:\1 corey projects\HEC\testing\" _
& rscoordinator.Fields("coordinator").Value & " " & Format(Date,
"mm-dd-yyyy") & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Query3",
strFileSpec, True, "" & (employee)
rscoordinator.MoveNext
Loop
.
- Follow-Ups:
- Re: code help exporting to Excel
- From: corkster
- Re: code help exporting to Excel
- Prev by Date: Re: HELP!
- Next by Date: When Opening Form
- Previous by thread: Re: HELP!
- Next by thread: Re: code help exporting to Excel
- Index(es):