E-mailing a report based on current record on form

This is a discussion on "E-mailing a report based on current record on form" within the Databases section. This forum, and the thread "E-mailing a report based on current record on form are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Aug 27th, 2007, 23:07
New Member
Join Date: Aug 2007
Location: California
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
E-mailing a report based on current record on form

Hello all,

I am looking for a way to be able to enter data into fields on a form, then be able to e-mail a report that shows only that record.

This is what I have thus far:

At the end of my Form, I have a Command Button. Right now the Command Button has an On Click... [Event Procedure] to basically E-mail a Report.

Here is my Visual Basic code for it:

Code: Select all
Private Sub Mail_Report_Button_Click()
On Error GoTo Err_Mail_Report_Button_Click

    Dim stDocName As String

    stDocName = "TrainingRequestSingle"
    DoCmd.SendObject acReport, stDocName

Exit_Mail_Report_Button_Click:
    Exit Sub

Err_Mail_Report_Button_Click:
    MsgBox Err.Description
    Resume Exit_Mail_Report_Button_Click
    
End Sub
The Report, "TrainingRequestSingle" basically has all of the Fields that are on the Form.

However, this Report that ends up being e-mailed has all of the Records the Form has total.

I want to to be able to click the Command Button to E-mail the Report which would then show only the current Record being viewed on the Form.

I have another Command Button on the same Form that Prints the current Record only (and not all Records) with success. I have tried manipulating it to work for my E-mailing situation with no success, however.

Here is the Visual Basic code I used in that situation:

Code: Select all
Private Sub Print_Record_Button_Click()
On Error GoTo Err_Print_Record_Button_Click


    DoCmd.OpenReport "TrainingRequestSingle", acViewPreview, , _
    "[TrainingRequestID]=Forms![Training Request Form]!TrainingRequestID"

Exit_Print_Record_Button_Click:
    Exit Sub

Err_Print_Record_Button_Click:
    MsgBox Err.Description
    Resume Exit_Print_Record_Button_Click
    
End Sub
The name of my form is:
Training Request Form

The name of my report is:
TrainingRequestSingle

The name of my e-mail report command button is:
Mail Report Button

I am using Microsoft Access 2002.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Reply

Tags
current, e mail, record, report

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding / Showing form fields based on previous form input John Alexander Hopper PHP Forum 1 Mar 10th, 2008 11:30
[SOLVED] Please help with creating a Mailing list form. Oak Starting Out 3 Dec 26th, 2007 18:54
Printing single record from Access via Report in Web Page Neotekk JavaScript Forum 0 Jun 18th, 2007 15:20
Opening a specific report by matching user input to report ame autoIT Databases 2 Apr 26th, 2007 17:32
form submission and mailing problems........aaaagh Gerry Web Page Design 3 Mar 15th, 2007 10:27


All times are GMT. The time now is 01:24.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved