Save Report to File

  • Thread starter Thread starter Kim
  • Start date Start date
K

Kim

I have a form. From the form I want to be able to save
the report to a file based on certain criteria.

Below is the code that I currently have but when I try to
run it I get this error message " The format that you are
trying to out put is not currently available".


Private Sub cmdSave1_Click()
On Error GoTo Err_cmdSave1_Click

Dim strwhere As String

strwhere = "[bsdirID] = " & bsdirID

Dim stDocName As String

stDocName = "rptBattleStaffDirectives"
DoCmd.OutputTo acOutputReport, stDocName, acPreview,
strwhere


Exit_cmdSave1_Click:
Exit Sub

Err_cmdSave1_Click:
MsgBox Err.Description
Resume Exit_cmdSave1_Click

End Sub

Does the report have to be open before you can e-mail it
or save it to a file?

Thank you.
..
 
Hi,
acPreview is an invalid syntax for the Output to method.
Here's an example using for example rtf format

DoCmd.OutputTo acOutputTable, "Employees",
acFormatRTF, "Employee.rtf", True

true or false means if you want to open it or not.
hth
 
Back
Top