Report Export Issue From Form (1 Viewer)

HeelNGville

Registered User.
Local time
Today, 08:18
Joined
Apr 13, 2004
Messages
71
Preface this with thanks in advance for any assistance in resolving this matter.

I have a form with a command button that is set to print an invoice report on the on click event. Code as follows:

Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click

DoCmd.RunCommand acCmdSaveRecord

Dim stDocName As String

Me.Visible = False
stDocName = "Shipping Order"
DoCmd.OpenReport stDocName, acNormal

Exit_cmdPrint_Click:
Exit Sub

Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click

End Sub
Within the Shipping Order report is the field "ShipOrderNumber".

What I would like to do is:

On the on click event,
(A) Print the report
(B) Export the report to C:/My Documents/ ----Use value from "ShipOrderNumber" field as report name.pdf (or snapshot). Example. If the shiporder number is 1234, export would be -C:/My Documents/1234.pdf

Currenlty using A2K.

Thx
 

Dennisk

AWF VIP
Local time
Today, 14:18
Joined
Jul 22, 2004
Messages
1,649
here is an example from the help file


DoCmd.OutputTo acOutputReport, strName, "Snapshot Format", strPath

you will not be able to output to a pdf format.

use a dlookup on the record source for the report to obtain the ShipOrderNumber and substitute that in the snapshot filename
 

Users who are viewing this thread

Top Bottom