Send Form w/ Multiple Subforms as body in an email (1 Viewer)

evictme

Registered User.
Local time
Today, 16:57
Joined
May 18, 2011
Messages
168
Hey Folks,

I've got a Form that loads 6 different subforms and Im trying to find the syntax for VBA that will allow me to create an email with the body that essentially looks like the Form itself or would export each subform (and it's records) as part of the email body with a button_click event.

I dont really have an idea as to where to start or what the best approach would be.

ANy help would be greatly app appreciated

Please see the form attached.
 

Attachments

  • Doc1.pdf
    90.1 KB · Views: 90

plog

Banishment Pending
Local time
Today, 16:57
Joined
May 11, 2011
Messages
11,646
Perhaps there's some VBA code in the world that does exactly what you want (Form to Email), But given your expected results it would probably be easier to just to compose the email yourself than it would be to find that code and fight with it to do what you want.

First, emails are just HTML. Second your forms aren't that complex to reproduce via HTML, even for a novice. I would divide and conquer this task in 4 steps:

1. Write a function to send an email from Access. Just a "Hello World" email back to yourself.

2. Into the above code, incorporate a recordset loop. Pick any table, load it into a recordset then have it just loop until its end, spitting its contents into the body of your email.

3. Using your favorite text editor recreate your .pdf as an .html file. Write the html necessary to reproduce your report in the text editor, then open the same file in a browser and keep saving the text file and refreshing the browser until you get what you want visually.

4. Combine 2 & 3. Take your html template and make it work with your recordset to populate the data you want where you want it in the html.
 

evictme

Registered User.
Local time
Today, 16:57
Joined
May 18, 2011
Messages
168
Thats actually a great suggestion. Thank you!
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:57
Joined
Feb 19, 2002
Messages
43,285
The simplest option is to create a report and then send the report as a pdf. I think you have to save it first. If any of the subforms have more rows than are visible on open, they will NOT show in the report image. The only way for the subforms to paginate is as subreports on a report.
 

Users who are viewing this thread

Top Bottom