OutputTo

  • Thread starter imstuck via AccessMonster.com
  • Start date
I

imstuck via AccessMonster.com

im using this code that will open a report:

Private Sub cmdDownload_Click()
On Error GoTo Err_cmdOpen_Click

Dim stDocName As String
Dim stLinkCriteria As String
If IsNull(Me!lstReports) Then
MsgBox "You must choose a report to download", vbExclamation
Else

stDocName = Me!lstReports.Column(0)
If Me!lstReports.Column(1) = "rpt" Then
DoCmd.OpenReport "rpt" & stDocName, acPreview
ElseIf Me!lstReports.Column(1) = "rpf" Then
DoCmd.OpenForm "frm" & stDocName, acNormal
End If

'Me.Visible = False
End If
Exit_cmdOpen_Click:
Exit Sub

Err_cmdOpen_Click:
MsgBox Err.Description
Resume Exit_cmdOpen_Click
End Sub


how can i modify it to save as Excel?
 
A

Arvin Meyer [MVP]

DoCmd.OutputTo acOutputForm, "FormName", acFormatXLS,
"C:\Projects\Test.xls", True
 
I

imstuck via AccessMonster.com

this is what i have on my command button:

Private Sub Command75_Click()

DoCmd.OutputTo acOutputReport, "Training Records by Trainees", acFormatXLS, ,
, "[TraineeID] = " & Me.TraineeID

End Sub

this saves on excel format, but shows all the records...how to save it by
TraineeID?

DoCmd.OutputTo acOutputForm, "FormName", acFormatXLS,
"C:\Projects\Test.xls", True
im using this code that will open a report:
[quoted text clipped - 25 lines]
how can i modify it to save as Excel?
 
A

Arvin Meyer [MVP]

Use the TraineeID as the Criteria in the underlying query.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


imstuck via AccessMonster.com said:
this is what i have on my command button:

Private Sub Command75_Click()

DoCmd.OutputTo acOutputReport, "Training Records by Trainees",
acFormatXLS, ,
, "[TraineeID] = " & Me.TraineeID

End Sub

this saves on excel format, but shows all the records...how to save it by
TraineeID?

DoCmd.OutputTo acOutputForm, "FormName", acFormatXLS,
"C:\Projects\Test.xls", True
im using this code that will open a report:
[quoted text clipped - 25 lines]
how can i modify it to save as Excel?
 
Top