Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi - This is a new topic. The belo 1

Status
Not open for further replies.

cimoli

Technical User
Jul 30, 2010
207
US
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
 
DoCmd.SendObject acReport, sReportNameInd, acFormatPDF, strTOvalueHere

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
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
 
Something like this:
DoCmd.SendObject acReport, sReportNameSpl, acFormatPDF, Me!EMAIL55

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks. all went well. done. Cimoli
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top