creating PDF's from Access 2003

  • Thread starter Thread starter MaryN
  • Start date Start date
M

MaryN

Guest
I am driving myself around a bend with this one. I currently have a button that the user presses and it attaches a filtered report (rtf) and places the email address in the "To" field. These reports now contain too much information to use the RTF format. I've pasted the code at the bottom of this text. I do not believe that snapshot is a viable option (correct me if I'm wrong) because regular individuals don't have the snapshot viewers dowloaded.

Is there anyway that I can set this up to create the PDF and attach it the same way in Outlook? We have distiller and Acrobat. All of the code I have found deals with Access 97 and "ini" files, which I am told by our systems department, are old windows files. I think I've check all Access and PDF developers sites!

Thank you!

Mary
Private Sub cmdSendConfirmation_Click()

Dim strDocName As String
Dim strWhere As String

strDocName = "rptEmail"
strWhere = "[OrgPeopleID]=" & Me!OrgPeopleID

If IsNull(Me![cboConfirmBy]) Then
DisplayMessage "You have not entered how to confirm the witness"
DoCmd.GoToControl "cboConfirmBy"
ElseIf (Me![cboConfirmBy] = "E-mail") And IsNull(Me![txtEmailAdd]) Then
DisplayMessage "When entered this contact you did not enter an email address!" _
& Chr(13) & "" _
& Chr(13) & "Please choose another option to confirm by" _
& Chr(13) & "" _
& Chr(13) & "Alternatively, close this from, return to the contact form" _
& Chr(13) & "and enter an email address, then return to confirm the witness"
ElseIf (Me![cboConfirmBy]) = "E-mail" Then
DoCmd.RunCommand acCmdRefresh
DoCmd.SendObject acSendReport, "rptEmail", , _
Forms!frmMeetingWitness!WitnessDetails!txtEmailAdd, , , "Confirmation", _
"Attached is your confirmation"
ElseIf (Me![cboConfirmBy]) = "Fax" Then
DoCmd.OpenReport strDocName, acViewPreview, , strWhere
ElseIf (Me![cboConfirmBy]) = "Mail" Then
DoCmd.OpenReport strDocName, acViewPreview, , strWhere
End If

End Sub
 
Not so much a solution, but a practical answer to the problem. If you use distiller, why not get access to print to a file and choose a working postscript printer. Then, through distiller, set up the watch folders and at your preset time interval, it will create the pdf which then can be dragged and dropped.

It seems there are a few issues when mixing the two programs. This workaround is slightly long winded than what you ideally want, but i am sure it will work.

Regards

Popolou
 
I send emails with .snp files attached and not had a problem yet with users not being able to read them.
 
Hello,

I have spent a day messing around with a similar problem. I too started looking at the Ken Getz code which deals with Win.ini and 5 different modules. This was a bit above me and I later found out that it might not be suitable for anything above Access 97.

So my solution is below.

I set the report to always print to PDF in My Documents.
I then in code print the report and then copy and rename it in a different folder.

The code is below. I also had to pause the code to allow the report to print before I copied it and have also included that module below which was created by Dev Ashish (thanks for that).

Private Sub test_Click()
Dim CICODE As String

CICODE = Me.SoldT

DoCmd.OpenReport "cba_data_master_cross", acViewNormal


Const cTIME = 5000 'in MilliSeconds
Call sSleep(cTIME)

Dim strFileOldName, strFileNewName As String
strFileOldName = "C:\Documents and Settings\szymkm\My Documents\CBA_Data_Master_Cross.pdf"
strFileNewName = "C:\Documents and Settings\szymkm\My Documents\" & CICODE & ".pdf"

FileCopy strFileOldName, strFileNewName
Kill strFileOldName

End Sub

Module

Option Compare Database

'***************** Code Start *******************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Sub sapiSleep Lib "kernel32" _
Alias "Sleep" _
(ByVal dwMilliseconds As Long)

Sub sSleep(lngMilliSec As Long)
If lngMilliSec > 0 Then
Call sapiSleep(lngMilliSec)
End If
End Sub

Sub sTestSleep()
Const cTIME = 3000 'in MilliSeconds
Call sSleep(cTIME)
MsgBox "Before this Msgbox, I was asleep for " _
& cTIME & " Milliseconds."
End Sub
'***************** Code End *********************


I hope this helps

Mark
 
Thanks Mark for the code and everyone else for your suggestions. Shortly after send the note, I found this link (I think it was here)

http://www.tek-tips.com/faqs.cfm?fid=2533

It goes into quite a bit of detail between platforms but I ended up with the same result as with Mark's code. It asked me to save the location of the PDF (I've tried changing the path, everything!).

The code is far beyond me but I did find out that we have PDFMaker not DPFWriter so I'm still messing around with this, but at least I'm a little closer to a solution.

Thanks again,

Mary
 

Users who are viewing this thread

Back
Top Bottom