Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This is easily the most helpful website I've ever used, and this is the best forum with the quickest response time bar none...."

Geography

Where in the world do Tek-Tips members come from?
cimoli (TechnicalUser)
11 Jun 12 15:44
Hi - This is a new topic. The below works well. Now I need to learn how to get an email field to be used and posted into the Outlook "TO" section. Is that possible?
I would need it to be part of the email button On Click code below. Thanks Cimoli.


Private Sub cmdEmailReport_Click()
'We have 2 kinds of reports based on group or non group walkin reservations.
'1- a regular Group reservation report #10 that uses report rptTicketIND and
'2- a Splinter NON Group reservation #20 that uses report rptTicketSplinterInd.


On Error GoTo Err_cmdEmailReport_Click

Dim lResort As Long, sReportNameSpl As String, sReportNameInd As String
lResort = Me.txtResortID


'Check to see if you have a proper resort number.
If Nz(DLookup("ReportName", "tblReport", "[Resort#]=" & lResort _
& " AND [ReportNum]=20"), "") = "" Then
MsgBox "No Resort Available"
Exit Sub

Else

'Dlookup gets the splinter reservation report NAME needed for code 20.
sReportNameSpl = DLookup("ReportName", "tblReport", "[Resort#]=" & lResort _
& " AND [ReportNum]=20")
End If

'Otherwise, Dlookup gets the Group reservation for 1 person report NAME needed for code 10.
sReportNameInd = DLookup("ReportName", "tblReport", "[Resort#]=" & lResort _
& " AND [ReportNum]=10")


If Not IsNull(Forms![frmReservation]!txtSplinterDateIN) Then
'DoCmd.OpenReport sReportNameSpl, acViewPreview
DoCmd.SendObject acReport, sReportNameSpl, acFormatPDF

Else

'DoCmd.OpenReport sReportNameInd, acViewPreview
DoCmd.SendObject acReport, sReportNameInd, acFormatPDF


Exit_cmdEmailReport_Click:
Exit Sub

Err_cmdEmailReport_Click:
MsgBox Err.Description
Resume Exit_cmdEmailReport_Click

End If
PHV (MIS)
11 Jun 12 15:55
DoCmd.SendObject acReport, sReportNameInd, acFormatPDF, strTOvalueHere

Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

cimoli (TechnicalUser)
11 Jun 12 17:03
PHV - thanks for the tip. I am not sure how to use it. I put it below inside 2 lines.
1 - Do i have to add something to the DIM ?
2 - I imagine you wanted me do something further with the .... strTOvalueHere.
3 - On my form, i have a field name of EMAIL55 that contains the email address.
Can you advise? Thanks much. Cimoli



Private Sub cmdEmailReport_Click()
'We have 2 kinds of reports based on group or non group walkin reservations.
'1- a regular Group reservation report #10 that uses report rptTicketIND and
'2- a Splinter NON Group reservation #20 that uses report rptTicketSplinterInd.


On Error GoTo Err_cmdEmailReport_Click

Dim lResort As Long, sReportNameSpl As String, sReportNameInd As String
lResort = Me.txtResortID


'Check to see if you have a proper resort number.
If Nz(DLookup("ReportName", "tblReport", "[Resort#]=" & lResort _
& " AND [ReportNum]=20"), "") = "" Then
MsgBox "No Resort Available"
Exit Sub

Else

'Dlookup gets the splinter reservation report NAME needed for code 20.
sReportNameSpl = DLookup("ReportName", "tblReport", "[Resort#]=" & lResort _
& " AND [ReportNum]=20")
End If

'Otherwise, Dlookup gets the Group reservation for 1 person report NAME needed for code 10.
sReportNameInd = DLookup("ReportName", "tblReport", "[Resort#]=" & lResort _
& " AND [ReportNum]=10")


If Not IsNull(Forms![frmReservation]!txtSplinterDateIN) Then

DoCmd.SendObject acReport, sReportNameSpl, acFormatPDF, strTOvalueHere

Else

DoCmd.SendObject acReport, sReportNameInd, acFormatPDF, strTOvalueHere


Exit_cmdEmailReport_Click:
Exit Sub

Err_cmdEmailReport_Click:
MsgBox Err.Description
Resume Exit_cmdEmailReport_Click

End If
Helpful Member!  PHV (MIS)
11 Jun 12 17:21
Something like this:
DoCmd.SendObject acReport, sReportNameSpl, acFormatPDF, Me!EMAIL55

Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

cimoli (TechnicalUser)
12 Jun 12 0:32
Thanks. all went well. done. Cimoli

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close