C
cw via AccessMonster.com
Here is my current code behind the Print button on my frmWizard & it works
fine:
---------------------------------------------------------
Private Sub Image370_Click()
On Error GoTo Err_Command370_Click
Dim lstRptName As String
lstRptName = "rptOrderPdf1"
Dim strDocName As String
Dim strID As String
strDocName = Me.ConName
strID = Me.ID
Me.Caption = strDocName & " " & "(CW-" & Format(strID, "00000") & ") New
Order placed on " & Format (Now, " mmmm d yyyy")
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport stDocName, acViewPreview
Exit_Command370_Click:
Exit Sub
Err_Command370_Click:
MsgBox Err.Description
Resume Exit_Command370_Click
End Sub
------------------------------------------------------
The query behind the Report links the ID of the frmWizard to the ID of the
rptOrderPdf1.
QUESTION?
----------------
How do I use Stephen Lebans code to output to a PDF based on the ID's ?
I tried to add a Where condition :
-----------------------------------------------------
Private Sub Command459_Click()
Dim lstRptName As String
lstRptName = "rptOrderPdf1"
Dim strDocName As String
Dim strID As String
strDocName = Me.ConName
strID = Me.ID
Me.Caption = strDocName & " " & "(CW-" & Format(strID, "00000") & ") New
Order placed on " & Format(Now, " mmmm d yyyy")
DoCmd.OpenReport lstRptName, acViewPreview, "[ID] = " & Forms![frmWizard]!
[ID] & ""
Call ConvertReportToPDF( lstRptName, vbNullString, lstRptName & ".PDF",
False)
End Sub
--------------------------------------------------
But get error 2501 (OpenReport action was cancelled) & it's stops on the
DoCmd line.
I'm having trouble understanding how to use conditions & Stephens code.
Anyone had any luck?
Here is the code link from Stephen Lebans site:
http://www.lebans.com/reporttopdf.htm
Thanks,
cw
fine:
---------------------------------------------------------
Private Sub Image370_Click()
On Error GoTo Err_Command370_Click
Dim lstRptName As String
lstRptName = "rptOrderPdf1"
Dim strDocName As String
Dim strID As String
strDocName = Me.ConName
strID = Me.ID
Me.Caption = strDocName & " " & "(CW-" & Format(strID, "00000") & ") New
Order placed on " & Format (Now, " mmmm d yyyy")
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport stDocName, acViewPreview
Exit_Command370_Click:
Exit Sub
Err_Command370_Click:
MsgBox Err.Description
Resume Exit_Command370_Click
End Sub
------------------------------------------------------
The query behind the Report links the ID of the frmWizard to the ID of the
rptOrderPdf1.
QUESTION?
----------------
How do I use Stephen Lebans code to output to a PDF based on the ID's ?
I tried to add a Where condition :
-----------------------------------------------------
Private Sub Command459_Click()
Dim lstRptName As String
lstRptName = "rptOrderPdf1"
Dim strDocName As String
Dim strID As String
strDocName = Me.ConName
strID = Me.ID
Me.Caption = strDocName & " " & "(CW-" & Format(strID, "00000") & ") New
Order placed on " & Format(Now, " mmmm d yyyy")
DoCmd.OpenReport lstRptName, acViewPreview, "[ID] = " & Forms![frmWizard]!
[ID] & ""
Call ConvertReportToPDF( lstRptName, vbNullString, lstRptName & ".PDF",
False)
End Sub
--------------------------------------------------
But get error 2501 (OpenReport action was cancelled) & it's stops on the
DoCmd line.
I'm having trouble understanding how to use conditions & Stephens code.
Anyone had any luck?
Here is the code link from Stephen Lebans site:
http://www.lebans.com/reporttopdf.htm
Thanks,
cw