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_C lick
Dim objPDF As PDFClass
Dim objMail As MailClass
Dim strCurFileName As String
Dim strBaseFileLoca tion 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.Connectio n '<- ADO
'Dim rsReports As New ADODB.Recordset '<- ADO
Const MAIL_SYS_CDO = -1
Const RECIPIENT_TO = 1
Const PDFENGINE_WIN2P DF = 3
Set rsReports = CurrentDb.OpenR ecordset("Selec t DISTINCT OfferteID,
emailadres from qryOfferteformG EN1PrintFILTER" , 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
qryOfferteformG EN1PRINT", conn, adOpenStatic, adReadOnly '<- ADO
strBaseFileLoca tion = "C:\"
Set objPDF = New PDFClass
Set objMail = New MailClass
Do Until rsReports.EOF 'End of File
strCurFileName = strBaseFileLoca tion & "Orders For " &
rsReports!Offer teID & ".pdf"
With objPDF
.PDFEngine = PDFENGINE_WIN2P DF
.ReportName = "Offerte-per-Email"
.ReportWhere = "[OfferteID] = " & rsReports!Offer teID
.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!Klant ID, rsReports!email adres, ,
RECIPIENT_TO, False
.AttachmentAdd strCurFileName, "Current Account Invoice.pdf"
.MsgSaveCopy = True
.SendMail MAIL_SYS_CDO
.RecipientsRese t '<- get ready for the next mail item
.AttachmentsRes et
End With
Else
MsgBox "Error!"
End If
rsReports.MoveN ext
Loop
rsReports.Close
Set objPDF = Nothing
Set objMail = Nothing
Exit_Command33_ Click:
Exit Sub
Err_Command33_C lick:
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.Connectio n"..
(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..
--
Regards
JvdWal