| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |
|

09-25-10, 16:42
|
|
Registered User
|
|
Join Date: May 2006
Posts: 352
|
|
Please help. Is it possible to send information from a form as an email attachment
|
|
Dear All,
Over the past one month I have been trying to do this myself but with no avail. I am not very good with codes, so I tried using Access's built in functions but with no luck.
We have a Form (MainBookingForm) where we enter clients booking orders. On this form we also have our employees details and details of clients order. I would like to know if it is possible that by clicking a command button selected information (fields) could automatically be sent as an attachment to the employee's email address which is also available on the same form.
At the moment, I already have a command button which opens a report with the required information from the said Form, but we have to manually save the report on the desktop or printpdf it and then send it as an attachment. As you know all of this involves a few manual steps.
These are the current fields I would be included on the report and sent to the employee's email address:
1- ClientID
2- EmployeeID
3- BookingID
4- ClientJobReferenceNumber
5- NoOfHoursBooked
6- RequestMadeBY
7- Contact Number
8- OrderTypeID
9- DateOfJob
10- TimeOfJob
11- VenueID
12- CustomersName
By the way, this is the code which captures the required information on the report which we then manually email to employees.
Quote:
Private Sub CmdPrintOrdersheet_Click()
Dim strReportName As String
Dim strCriteria As String
If NewRecord Then
MsgBox "This record contains no data. Please select a record to print or Save this record." _
, vbInformation, "Invalid Action"
Exit Sub
Else
strReportName = "OrderSheet7"
strCriteria = "[id]=" & Me.Id
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
End If
End Sub
|
Any help and ideally a code for this function would be highly appreciated.
__________________
Emi-UK
Love begets Love, Help Begets Help
|
|

09-27-10, 10:51
|
|
Registered User
|
|
Join Date: Apr 2004
Location: metro Detroit
Posts: 589
|
|
Take a look at the help for 'SendObject' and see if that does what you need.
|
|

09-27-10, 11:12
|
|
Registered User
|
|
Join Date: May 2006
Posts: 352
|
|
|
|
Hi Rogue,
Thank you for your response. I have actually looked into this but this can only send text only and does not generate the required information on a report or send it as an attachment.
Any help would be extremely and highly appreciated
__________________
Emi-UK
Love begets Love, Help Begets Help
|
|

09-27-10, 12:59
|
|
Registered User
|
|
Join Date: Apr 2004
Location: metro Detroit
Posts: 589
|
|
SendObject allows you to send a snapshot of the actual report.
SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile)
ObjectType = acSendReport
ObjectName = name of your report
OutputFormat = acFormatSNP
|
|

09-27-10, 13:20
|
|
Registered User
|
|
Join Date: May 2006
Posts: 352
|
|
Hi Rogue,
Thank you for your continued support on this. but we do not want to send a snapshot of the form but the report. the button that I click which opens a report with all the data captured from the form, and that is the report I would like to be sent to that employee's email address as a PDF file as soon as I click on the Email Worksheet Button.
Or if not PDF, then I would like to be able to add another text and an SNPviewer.exe file so that anyone who does not have a SNP viewer could simply download it from the link that I would like to be added with the standard email.
Thank you for your continued support.
__________________
Emi-UK
Love begets Love, Help Begets Help
|
|

09-27-10, 13:31
|
|
Registered User
|
|
Join Date: Apr 2004
Location: metro Detroit
Posts: 589
|
|
If you need a pdf, we'll need a bit of information.....
What pdf writer will be used?
What email program will be used?
What version of Access will be used?
|
|

09-27-10, 13:36
|
|
Registered User
|
|
Join Date: May 2006
Posts: 352
|
|
Thank you Rogue,
The PDF writer that will be used is called DeskPDF
Email program will be Ms Outlook 2002
We are using Access 2002
Thank you very much.
__________________
Emi-UK
Love begets Love, Help Begets Help
|
|

09-27-10, 13:56
|
|
Registered User
|
|
Join Date: Apr 2004
Location: metro Detroit
Posts: 589
|
|
|
|

09-27-10, 15:22
|
|
Registered User
|
|
Join Date: May 2006
Posts: 352
|
|
Thank you rogue,
I have been following the instructions given in the above link, I am unable to find the Debug window within an access Module. Basically the last instruction by Microsoft after writing the code in a module says,
Quote:
To test this procedure, type the following line in the Debug window, and then press ENTER.
SendMessage True, "C:\My Documents\Customers.txt"
|
But I dont know where is the Debug window in a module, I copied and pasted it in the Immeidate Window and after I click on Debug/Compile nothing happens and when I click on Run, it asks me for module name.
Any help would be much appreciated.
__________________
Emi-UK
Love begets Love, Help Begets Help
|
|

09-27-10, 15:34
|
|
Registered User
|
|
Join Date: May 2006
Posts: 352
|
|
sorry, I followed the instructions given by Microsoft Office and it worked up to the point where I pasted this code
Quote:
|
SendMessage True, "C:\My Documents\Customers.txt"
|
in the Immeidate/Debug window of the module and pressed Enter then it opened Outlook email with an attachment (Customers.txt file) with some a name into To and Cc and Bcc.
However, I dont know how to automate the whole process so after clickon on the command button it should actually covered the report with the data that appers on the form and then send it to the email address of the employee whose detail appears on that particular booking order.
Your kind sep by step information and guidance would be highly appreciated.
__________________
Emi-UK
Love begets Love, Help Begets Help
|
|

09-27-10, 15:46
|
|
Registered User
|
|
Join Date: Apr 2004
Location: metro Detroit
Posts: 589
|
|
The first thing you need to do is create the pdf file. I haven't used DeskPDF, but it sounds like the link in the other thread is not dependent on your pdf writer.
Are you able to create the pdf?
|
|

09-27-10, 16:02
|
|
Registered User
|
|
Join Date: May 2006
Posts: 352
|
|
that is correct, the link you provided that not say much except to copy and paste the two DLL files into windows/system32 folder which i did. I am stuck now and do not know my way foreward. Please kindly help me sort this one out.
__________________
Emi-UK
Love begets Love, Help Begets Help
|
|

09-27-10, 16:39
|
|
Registered User
|
|
Join Date: Apr 2004
Location: metro Detroit
Posts: 589
|
|
There is also a file named A2000SnapshotToPDFver785.mdb that has the code and a couple of forms. Take a look at the forms and give it a try.
|
|

09-27-10, 16:53
|
|
Registered User
|
|
Join Date: May 2006
Posts: 352
|
|
Thank you for that, I did not realise that I had download the MDB file as well, I will go through the codes and will update you accordingly. Thank you so much.
__________________
Emi-UK
Love begets Love, Help Begets Help
|
|

09-27-10, 17:18
|
|
Registered User
|
|
Join Date: May 2006
Posts: 352
|
|
Ok Rogue,
I have gone through the MDB file and I could see the code but when I pasted it on my form it did not work, first it gave me a compile error on Me.Booking7 which is in bold :
Quote:
Dim blRet As Boolean
' Call our convert function
' Please note the last param signals whether to perform
' font embedding or not. I have turned font embedding ON for this example.
blRet = ConvertReportToPDF(Me.Booking7, vbNullString, _
Me.Booking7.Value & ".pdf", False, True, 150, "", "", 0, 0, 0)
' To modify the above call to force the File Save Dialog to select the name and path
' for the saved PDF file simply change the ShowSaveFileDialog param to TRUE.
|
Please note that Booking7 is the name my report which I would like to convert to PDF and automatically appear as an email attachment with some alreay starndard written text and subject on the email.
__________________
Emi-UK
Love begets Love, Help Begets Help
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|