Connecting Tech Pros Worldwide Forums | Help | Site Map

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

JvdWal
Guest
 
Posts: n/a
#1: Nov 12 '05
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


Lyle Fairfield
Guest
 
Posts: n/a
#2: Nov 12 '05

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


JvdWal <JvdWal@nospam.com> wrote in news:bpi9uq$79i$1@news.cistron.nl:
[color=blue]
> 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[/color]

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)
JvdWal
Guest
 
Posts: n/a
#3: Nov 12 '05

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


Lyle Fairfield wrote:[color=blue]
> JvdWal <JvdWal@nospam.com> wrote in news:bpi9uq$79i$1@news.cistron.nl:
>
>[color=green]
>>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[/color]
>
>
> lngReturn is a variable and not a member of objPDF.
>
> So this may be more successful:
>
> lngReturn = .Result[/color]

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

Tony Gardner
Guest
 
Posts: n/a
#4: Nov 12 '05

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


In Access 97 the requirement is .MsgSubjectText. See if that works.
Tony Gardner

JvdWal <JvdWal@nospam.com> wrote in message news:<bpibdt$8v7$1@news.cistron.nl>...[color=blue]
> Lyle Fairfield wrote:[color=green]
> > JvdWal <JvdWal@nospam.com> wrote in news:bpi9uq$79i$1@news.cistron.nl:
> >
> >[color=darkred]
> >>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[/color]
> >
> >
> > lngReturn is a variable and not a member of objPDF.
> >
> > So this may be more successful:
> >
> > lngReturn = .Result[/color]
>
> 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------------[/color]
JvdWal
Guest
 
Posts: n/a
#5: Nov 12 '05

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


Tony Gardner wrote:[color=blue]
> In Access 97 the requirement is .MsgSubjectText. See if that works.
> Tony Gardner[/color]

Hi,

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

--
Regards
JvdWal

Closed Thread