Convert Form to PDF problems

James001

Registered User.
Local time
Today, 13:56
Joined
Jul 28, 2011
Messages
16
Hi,
I have a little problem i am using the microsoft converter to pdf in my forms. I have made a command buttong that converts and inserts it as an email attachment. The problem is when i view the attachment it contains all the records. Is there a Me statement that i need to put into it so that it only shows the current record? If so where do i put it into the code. Currently my VB code states this

Code:
DoCmd.SendObject acSendForm, "frmInvoice", acFormatPDF

I know i am missing something, your help is appreciated.

James
 
Hi..

There are a few ways to do this.
I suggest one of the..:

Code:
On Error GoTo hata

Dim trz, oldsource As String
trz = " [ID]=" & [ID] 'Change with the name of the ID field
oldsource = Form.RecordSource

trz = "select * from(" & oldsource & ") where " & trz
Form.RecordSource = trz
DoCmd.SendObject acSendForm, "frmInvoice", acFormatPDF
Form.RecordSource = oldsource

exit_hata:
    Exit Sub
 
hata:
Form.RecordSource = oldsource

the source of the form, as a temporary change. returns to normal after sending email.. ;)
 
Ok i tried the code and replaced the ID field with my invoiceid. when i fire the command buttonn it refreshes but it does not prompt or convert the form to pdf or prompt outlook.

Thanks
 

Users who are viewing this thread

Back
Top Bottom