A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

email report with current record



 
 
Thread Tools Display Modes
  #1  
Old May 26th, 2004, 09:11 PM
Mario
external usenet poster
 
Posts: n/a
Default email report with current record

How can I view in a report only the current record displayed in a form, being able also to email it as an attachment,also print it?
  #2  
Old May 26th, 2004, 10:04 PM
Rick B
external usenet poster
 
Posts: n/a
Default email report with current record

Something like the following in your OnClick for a button...


Private Sub Send_Email_Click()
On Error GoTo Err_Send_Email_Click
Dim msg

If (IsNull([some ReferenceOrKey])) Then
msg = "Please select a record before creating the email."
MsgBox (msg)
'If no record selected, stop procedure
Exit Sub
End If

Dim varSubject As String
Dim varText As String
Dim varDocName As String
Dim varRep As String

varSubject = "Your Subject"
varText = "Some Text to place in message."
varDocName = "NameOfYourReportHere"

DoCmd.OpenReport varDocName, acViewPreview, "", "" ' Open the Report
DoCmd.SendObject acSendReport, , "Snapshot Format", , , , varSubject,
varText, True
DoCmd.Close

Exit_Send_Email_Click:
Exit Sub

Err_Send_Email_Click:
MsgBox Err.Description
Resume Exit_Send_Email_Click





Hope that helps,

Rick B


"Mario" wrote in message
...
How can I view in a report only the current record displayed in a form,
being able also to email it as an attachment,also print it?


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.