J
JvdWal
Hi,
I've been trying the PDF & Mail Class Library from ACG Soft
in combination with Northwind-2k3 style of db. Can someone help
me with the error which is popping up: (which I cant get solved..)
I'm trying to send a report in PDF-format with a unique QuotationID to
one specific customer by Email. >> Button in a form >> quotation-report
and a "filter and printfilter"- query..
MS Visual Basic Compile Error:
"Method or data member not found"
With the next line highlighted in the code:
.lngReturn = .Result
-------------Here is the code----------------
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click
Dim objPDF As PDFClass
Dim objMail As MailClass
Dim strCurFileName As String
Dim strBaseFileLocation As String
Dim lngReturn As Long
Dim rsReports As Recordset '<- DAO recordset
'Comment out the line above and uncomment the two lines below when using
ADO in A2000 and 2002
'Dim conn As ADODB.Connection '<- ADO
'Dim rsReports As New ADODB.Recordset '<- ADO
Const MAIL_SYS_CDO = -1
Const RECIPIENT_TO = 1
Const PDFENGINE_WIN2PDF = 3
Set rsReports = CurrentDb.OpenRecordset("Select DISTINCT OfferteID,
emailadres from qryOfferteformGEN1PrintFILTER", dbOpenSnapshot) '<- DAO
recordset
'Comment out the line above and uncomment the two lines below when using
with ADO in A2000 and 2002
'Set conn = CurrentProject.Connection '<- ADO
'rsReports.Open "Select DISTINCT OfferteID, emailadres from
qryOfferteformGEN1PRINT", conn, adOpenStatic, adReadOnly '<- ADO
strBaseFileLocation = "C:\"
Set objPDF = New PDFClass
Set objMail = New MailClass
Do Until rsReports.EOF 'End of File
strCurFileName = strBaseFileLocation & "Orders For " &
rsReports!OfferteID & ".pdf"
With objPDF
.PDFEngine = PDFENGINE_WIN2PDF
.ReportName = "Offerte-per-Email"
.ReportWhere = "[OfferteID] = " & rsReports!OfferteID
.OutputFile = strCurFileName
.PrintImage
.lngReturn = .Result
End With
If lngReturn = True Then '<- PDF was output successfully
With objMail
..MsgSubject = "Current Invoice"
.MsgBodyText = "Attached is the current invoice for your
account in PDF format."
.RecipientAdd rsReports!KlantID, rsReports!emailadres, ,
RECIPIENT_TO, False
.AttachmentAdd strCurFileName, "Current Account Invoice.pdf"
.MsgSaveCopy = True
.SendMail MAIL_SYS_CDO
.RecipientsReset '<- get ready for the next mail item
.AttachmentsReset
End With
Else
MsgBox "Error!"
End If
rsReports.MoveNext
Loop
rsReports.Close
Set objPDF = Nothing
Set objMail = Nothing
Exit_Command33_Click:
Exit Sub
Err_Command33_Click:
MsgBox Err.Description
Resume Exit_Command33_Click
End Sub
-------------END of the code----------------
Whats wrong,... I've been trying, trying and trying...?!?
I heve been commenting out as well the ADO/DAO lines to 2000/2002,
then I get an error in "Dim conn As ADODB.Connection"..
(What my Access knowledge concerns, not a newbie, but have not much
VB programmskils either, more reading it a bit and cut&paste :-(
I'm using Access 2003 btw.
Hope someone can help me with this..
I've been trying the PDF & Mail Class Library from ACG Soft
in combination with Northwind-2k3 style of db. Can someone help
me with the error which is popping up: (which I cant get solved..)
I'm trying to send a report in PDF-format with a unique QuotationID to
one specific customer by Email. >> Button in a form >> quotation-report
and a "filter and printfilter"- query..
MS Visual Basic Compile Error:
"Method or data member not found"
With the next line highlighted in the code:
.lngReturn = .Result
-------------Here is the code----------------
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click
Dim objPDF As PDFClass
Dim objMail As MailClass
Dim strCurFileName As String
Dim strBaseFileLocation As String
Dim lngReturn As Long
Dim rsReports As Recordset '<- DAO recordset
'Comment out the line above and uncomment the two lines below when using
ADO in A2000 and 2002
'Dim conn As ADODB.Connection '<- ADO
'Dim rsReports As New ADODB.Recordset '<- ADO
Const MAIL_SYS_CDO = -1
Const RECIPIENT_TO = 1
Const PDFENGINE_WIN2PDF = 3
Set rsReports = CurrentDb.OpenRecordset("Select DISTINCT OfferteID,
emailadres from qryOfferteformGEN1PrintFILTER", dbOpenSnapshot) '<- DAO
recordset
'Comment out the line above and uncomment the two lines below when using
with ADO in A2000 and 2002
'Set conn = CurrentProject.Connection '<- ADO
'rsReports.Open "Select DISTINCT OfferteID, emailadres from
qryOfferteformGEN1PRINT", conn, adOpenStatic, adReadOnly '<- ADO
strBaseFileLocation = "C:\"
Set objPDF = New PDFClass
Set objMail = New MailClass
Do Until rsReports.EOF 'End of File
strCurFileName = strBaseFileLocation & "Orders For " &
rsReports!OfferteID & ".pdf"
With objPDF
.PDFEngine = PDFENGINE_WIN2PDF
.ReportName = "Offerte-per-Email"
.ReportWhere = "[OfferteID] = " & rsReports!OfferteID
.OutputFile = strCurFileName
.PrintImage
.lngReturn = .Result
End With
If lngReturn = True Then '<- PDF was output successfully
With objMail
..MsgSubject = "Current Invoice"
.MsgBodyText = "Attached is the current invoice for your
account in PDF format."
.RecipientAdd rsReports!KlantID, rsReports!emailadres, ,
RECIPIENT_TO, False
.AttachmentAdd strCurFileName, "Current Account Invoice.pdf"
.MsgSaveCopy = True
.SendMail MAIL_SYS_CDO
.RecipientsReset '<- get ready for the next mail item
.AttachmentsReset
End With
Else
MsgBox "Error!"
End If
rsReports.MoveNext
Loop
rsReports.Close
Set objPDF = Nothing
Set objMail = Nothing
Exit_Command33_Click:
Exit Sub
Err_Command33_Click:
MsgBox Err.Description
Resume Exit_Command33_Click
End Sub
-------------END of the code----------------
Whats wrong,... I've been trying, trying and trying...?!?
I heve been commenting out as well the ADO/DAO lines to 2000/2002,
then I get an error in "Dim conn As ADODB.Connection"..
(What my Access knowledge concerns, not a newbie, but have not much
VB programmskils either, more reading it a bit and cut&paste :-(
I'm using Access 2003 btw.
Hope someone can help me with this..