Access 97 and email

A

arnicot

Hi!
I built a report which contains orders I'd like to email. I didn't find
the way to select individually the orders. So far, all the report (as a
unique entity) can be attached to an email instead of proceeding order
by order.
Could someone help me ?
Thanks
 
T

Tom Wickerath

Hello Arnicot,

Here is a method that I used a few years ago, when I was teaching a
beginning Access course. At the end of the quarter, I would send out a
message to all students, which included a snapshot report of the scores that
I had recorded for the assignments, quizes, tests, etc. This code was used in
an Access 2000 database, but I believe it should work in Access 97 without a
problem.

The report, which was named "rptStudentScores", was based on query that
included a criteria that looked to the record on the open form to grab it's
primary key. The command button, named "cmdSendReportToStudent" was placed on
the same form, which was named "frmStudents". The query's criteria includes
the following for the primary key field:

[Forms]![frmStudents]![PK_StudentID]

In my case, I simply hard-coded the text of the message, since it didn't
need to be customized for each student. I also used EditMessage:=True, so
that I could add any additional text to a particular message if I so desired.
With EditMessage:=False, you will get a security warning if you have
installed all of the Office service packs (at least in Access 2000 and
above--I don't know for sure about Access 97, but I suspect the same is true).

Here is the code that is run when the command button on the form is clicked:

Private Sub cmdSendReportToStudent_Click()
On Error GoTo ProcError

Dim strDocName As String
Dim strReceipient As String
Dim strFirstName As String
Dim strSubject As String
Dim strMessage As String

strDocName = "rptStudentScores"
strReceipient = Me!sfrm1!EMailAddress
strFirstName = Me!FirstName
strSubject = "Recorded Scores"
strMessage = "Hello " & strFirstName & " -" & vbCrLf & vbCrLf & _
"Here is a summary of the scores that I have recorded for you." _
& " I hope you feel you have learned a lot about Access in the last 11
weeks." _
& vbCrLf & vbCrLf & "Tom Wickerath" & vbCrLf & vbCrLf & vbCrLf & _
"PS. If you cannot open the attached file, then you need to install " _
& "the SnapShot viewer utility. It can also be downloaded from
Microsoft at: " _
& vbCrLf & "
http://www.microsoft.com/accessdev/prodinfo/snapshot.htm" _
& vbCrLf & vbCrLf & "Make a note of the folder that you save it to.
After the " _
& "download is complete, use Windows Explorer to open this folder, and
install the " _
& "viewer by double-clicking on the Snapvw.exe file."

DoCmd.SendObject ObjectType:=acReport, ObjectName:=strDocName, _
OutputFormat:=acFormatSNP, To:=strReceipient, _
Subject:=strSubject, MessageText:=strMessage,
EditMessage:=True

ExitProc:
Exit Sub

ProcError:
MsgBox "Error: " & Err.Number & ". " & Err.Description, _
vbCritical, "Error in cmdSendReport procedure..."
Resume ExitProc

End Sub



Tom
_________________________________________

:

Hi!
I built a report which contains orders I'd like to email. I didn't find
the way to select individually the orders. So far, all the report (as a
unique entity) can be attached to an email instead of proceeding order
by order.
Could someone help me ?
Thanks
 
A

arnicot

Hi! Tom
Thank you for your advice.
I gonna to give it a try.

BTW: Why not to use a free PDF product which would be probably more
"standard" than snapshot ?
 
T

Tom Wickerath

BTW: Why not to use a free PDF product which would be probably more
"standard" than snapshot ?

You can certainly output to .PDF format if you so desire. I find it a lot
easier to output to Snapshot format. I can basically do it in one line of
code. It just depends on your situation. I don't believe that you can achieve
the same result using any of these products (although, to be honest, I have
never tried using CutePDF or any of the other related products).

One reason that I really like Snapshot format is that you are guaranteed to
have an exact copy of the report at the time it was generated, including all
formatting. Sometimes, outputting a report to .PDF format results in the loss
of certain report formats. It can cause extra work to go back and re-design a
report that will export to .PDF.

Several of the free products for outputting to PDF are free only for
personal use. They are not free for use in an application that is used by a
business. I work for a large Fortune 500 company. There is a strict policy
that prohibits installing executable files of any kind, unless one goes up
the chain of command and gets the appropriate approvals. This is *not* and
easy process. The snapshot viewer is considered a standard at my company; it
is loaded by default on all user's workstations.

The snapshot format is native to Access, so as long as the receipients are
using Windows based PC's (or Mac's with the appropriate emulation software),
they should be able to view and print the snapshot without a problem.

Tom
_______________________________________

:

Hi! Tom
Thank you for your advice.
I gonna to give it a try.

BTW: Why not to use a free PDF product which would be probably more
"standard" than snapshot ?
 
Top