daniels012
01-06-2010, 10:09 AM
I have a button on my form that Prints the current Work Order report.
Function PrintWOMacro()
On Error GoTo PrintWOMacro_Err
DoCmd.Echo False, ""
DoCmd.OpenReport "RptWorkOrder", acPreview, "", "[QryWorkOrder]![WorkOrderID]=[Forms]![FrmWorkOrderData]![WorkOrderID]"
If (Forms!FrmWorkOrderData!NoChargeWO = True) Then
Reports!RptWorkOrder!NoChargeWOLabel.Visible = True
End If
If (Forms!FrmWorkOrderData!NoChargeWO = True) Then
Reports!RptWorkOrder!NoChargeWO2.Visible = True
End If
DoCmd.PrintOut acPrintAll, 1, 1, acHigh, 1, True
DoCmd.Close acReport, "RptWorkOrder"
PrintWOMacro_Exit:
Exit Function
PrintWOMacro_Err:
MsgBox Error$
Resume PrintWOMacro_Exit
End Function
What code can i add to this code (and where) to also copy as a pdf file on the desktop. Basically I want it to make a copy into a folder on my desktop and then print.
I need the file name to be from the report: Report name = RptWorkOrder
The name of the file needs to be the field: PhysicalCompany then a space and then the field: WorkOrderID
Info: Using Office 2007, Folder on the desktop is "Clients"
Thannk You,
MIchael
Function PrintWOMacro()
On Error GoTo PrintWOMacro_Err
DoCmd.Echo False, ""
DoCmd.OpenReport "RptWorkOrder", acPreview, "", "[QryWorkOrder]![WorkOrderID]=[Forms]![FrmWorkOrderData]![WorkOrderID]"
If (Forms!FrmWorkOrderData!NoChargeWO = True) Then
Reports!RptWorkOrder!NoChargeWOLabel.Visible = True
End If
If (Forms!FrmWorkOrderData!NoChargeWO = True) Then
Reports!RptWorkOrder!NoChargeWO2.Visible = True
End If
DoCmd.PrintOut acPrintAll, 1, 1, acHigh, 1, True
DoCmd.Close acReport, "RptWorkOrder"
PrintWOMacro_Exit:
Exit Function
PrintWOMacro_Err:
MsgBox Error$
Resume PrintWOMacro_Exit
End Function
What code can i add to this code (and where) to also copy as a pdf file on the desktop. Basically I want it to make a copy into a folder on my desktop and then print.
I need the file name to be from the report: Report name = RptWorkOrder
The name of the file needs to be the field: PhysicalCompany then a space and then the field: WorkOrderID
Info: Using Office 2007, Folder on the desktop is "Clients"
Thannk You,
MIchael