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
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