Sending Forms or picture of forms

R

Ryan

Hello fellow databasers, I am a rookie in access. I put a command button on
my form to sendobject. The problem is that it sends the table and not the
form. I need to be able to send various people either the form OR a picture
of the form. They don't necessarily need the actual working form but just the
information on it.

A report wont work because they need it in real time and there are a lot of
these forms filled out. If i cant send the form info individually, i'm going
to have to totally recreate our process. Any help on this would be greatly
appreciated.
 
A

Albert D. Kallal

The only realistic approach to make this work is to actually build a report
that lays out the data the same as on your screen.

I would then suggest that you use one of the freed PDF creators.

Thus when you're looking at the form you'll press a button, printer report
out as the PDF file, and then launcher the e-mail client and attach the pdf.

if you don't want install any additional software, then another way is to
use and object and use the rich text format. you as a general rule will lose
all your graphics formatting, but you can build text report layout that will
quite well resemble your screen.

The trick in the above is to make sure that you set up a filter, or use a
we're clause for the report to only send out the one record you currently
viewing.

Regardless, in all of the above suggestions it simply means that you're
gonna have to build a report that lays out the data very similar to your
screen .
the code for printing the current record to a form is:

if me.Dirty = True then
me.Dirty = false ' force disk write of data
end if
docmd.OpenRepot "nameOfReprot",,,"id = " & me!id

if you want to preview, then go

docmd.OpenRepot "nameOfReprot",acViewPreview,,"id = " & me!id

If you install a free pdf creator, then you can print the above report to a
pdf file, and then launch your email, and attach that pdf file. (or, you can
write some code to do the attaching for you).

You'll find the code to create the pdf here:

http://www.lebans.com/reporttopdf.htm

You likely should get the above sample working on your computer before you
attempt to move and copy that above code into your own application. (So get
his sample working first). Do note the above sample also requires that you
place the appropriate DLL files in the same folder as your application.

You will have to use outlook automation (and therefore this means the user
will have to be using a outlook, not outlook express for their e-mail
client) to auto attached the pdf file.

So the whole approach here is that you're going to create a PDF a file that
is SAVED to disk. You then created the e-mail, and then set that pdf file as
an attachment.

The following code shows you how to start an outlook session, and then
attach a file of your choice to the e-mail.

So, *after* you create the pdf file, YOU then simply start a outlook
session, and attach the file you made using the pdf library.

eg:
dim strDocName as string
' send to user via email
'Dim ol As Outlook.Application
Dim ol As Object ' Late binding
'Dim ns As NameSpace
Dim ns As Object ' Late bind
'Dim newmessage As MailItem
Dim newmessage As Object ' Late bind

Dim mymessage As String
'Dim objOutlookAttach As Outlook.Attachment
'Dim objOutlookAttach As Object

strDocname = "c:\mydata\Report.pdf"

Set ol = GetObject(, "Outlook.Application")
Set ns = ol.GetNamespace("MAPI")
ns.Logon
Set newmessage = ol.CreateItem(0) ' 0 = olMainItem
With newmessage
.Recipients.Add strEmailTo
.Subject = strSubject
.Body = strMsgText
'Set objOutlookAttach = .Attachments.Add(stDocName)
.Attachments.Add (strDocName)
.Display
' .Send
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top