By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,200 Members | 1,640 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,200 IT Pros & Developers. It's quick & easy.

ACG Soft - "PDF & Mail Class Library" - Email PDF from Access 2k3

P: n/a
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..

--
Regards
JvdWal

Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
JvdWal <Jv****@nospam.com> wrote in news:bp**********@news.cistron.nl:
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


lngReturn is a variable and not a member of objPDF.

So this may be more successful:

lngReturn = .Result
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #2

P: n/a
Lyle Fairfield wrote:
JvdWal <Jv****@nospam.com> wrote in news:bp**********@news.cistron.nl:

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

lngReturn is a variable and not a member of objPDF.

So this may be more successful:

lngReturn = .Result


Hi, thanks for the quick reaction!

I changed the line into your suggestion: the tail of code is now like
this, but now with a highlighted compile error on ".MsgSubject":
- I kept the caption in the report empty, if it has something to do with
it..)
- configured Outlook to send the emails. (dont know if there support for
Mozilla.. ;-)

---------------tail of the code------------
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 code------------

--
Regards,
JvdWal

Nov 12 '05 #3

P: n/a
In Access 97 the requirement is .MsgSubjectText. See if that works.
Tony Gardner

JvdWal <Jv****@nospam.com> wrote in message news:<bp**********@news.cistron.nl>...
Lyle Fairfield wrote:
JvdWal <Jv****@nospam.com> wrote in news:bp**********@news.cistron.nl:

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

lngReturn is a variable and not a member of objPDF.

So this may be more successful:

lngReturn = .Result


Hi, thanks for the quick reaction!

I changed the line into your suggestion: the tail of code is now like
this, but now with a highlighted compile error on ".MsgSubject":
- I kept the caption in the report empty, if it has something to do with
it..)
- configured Outlook to send the emails. (dont know if there support for
Mozilla.. ;-)

---------------tail of the code------------
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 code------------

Nov 12 '05 #4

P: n/a
Tony Gardner wrote:
In Access 97 the requirement is .MsgSubjectText. See if that works.
Tony Gardner


Hi,

Its working now, with this one and some other small changes..
Tnx!

--
Regards
JvdWal

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.