C
Carol via AccessMonster.com
I have a command button on a form. It runs the query just fine.
1. But I also need it to after running the query, export the query to excel
to the c:\documents and settings
2. To also be able to run the next query and export to same excel file but a
different sheet and name the sheet tab.. instead of sheet1 it would be mgrs2
here's my code so far to run the query:
Private Sub Querymgrs_Click()
On Error GoTo Err_Querymgrs_Click
Dim stDocName As String
stDocName = "Querymgrs"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Querymgrs_Click:
Exit Sub
Err_Querymgrs_Click:
MsgBox Err.Description
Resume Exit_Querymgrs_Click
End Sub
1. But I also need it to after running the query, export the query to excel
to the c:\documents and settings
2. To also be able to run the next query and export to same excel file but a
different sheet and name the sheet tab.. instead of sheet1 it would be mgrs2
here's my code so far to run the query:
Private Sub Querymgrs_Click()
On Error GoTo Err_Querymgrs_Click
Dim stDocName As String
stDocName = "Querymgrs"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Querymgrs_Click:
Exit Sub
Err_Querymgrs_Click:
MsgBox Err.Description
Resume Exit_Querymgrs_Click
End Sub