Hi,
I have some code which runs when a user clicks a button, which notifies the user (msgbox) that an alert will be sent to the administrator if they elect to continue. If they click Continue, I would like to call a module which sends the email, then continues with the code that runs my query and launches Excel.
I have the module working correctly, I just can't find out how to call it from within this code below. I don't even know if it's possible?! if there is a better way to do this then please advise me. thanks for any help,
FrankyG
Private Sub CmdMonthVals_Click()
If IsNull(Me.p1start) Or IsNull(Me.p1end) Then
msgbox "Both dates are required"
Else
If Me.p1start > Me.p1end Then
msgbox "End Date earlier than Start Date"
Else
On Error GoTo Err_CmdMonthVals_Click
Dim intButSelected As Integer, intButType As Integer
Dim strMsgPrompt As String, strMsgTitle As String
strMsgPrompt = "This action will be logged, and an alert sent to the administrator. Continue?"
strMsgTitle = "Restricted Access"
intButType = vbYesNo + vbInformation + vbDefaultButton2
intButSelected = msgbox(strMsgPrompt, intButType, strMsgTitle)
If intButSelected = vbYes Then
DoCmd.SetWarnings False
'I want to call the SendMail module HERE!!
DoCmd.OpenQuery "QryGraphData", acNormal, acEdit
Call Shell("""C:\Program Files\Microsoft Office\Office\EXCEL.EXE"" ""path to file.xls""", 1)
Exit_CmdMonthVals_Click:
Exit Sub
Err_CmdMonthVals_Click:
msgbox Err.Description
Resume Exit_CmdMonthVals_Click
DoCmd.SetWarnings True
End If
Exit Sub
End If
End If
End Sub
I have some code which runs when a user clicks a button, which notifies the user (msgbox) that an alert will be sent to the administrator if they elect to continue. If they click Continue, I would like to call a module which sends the email, then continues with the code that runs my query and launches Excel.
I have the module working correctly, I just can't find out how to call it from within this code below. I don't even know if it's possible?! if there is a better way to do this then please advise me. thanks for any help,
FrankyG
Private Sub CmdMonthVals_Click()
If IsNull(Me.p1start) Or IsNull(Me.p1end) Then
msgbox "Both dates are required"
Else
If Me.p1start > Me.p1end Then
msgbox "End Date earlier than Start Date"
Else
On Error GoTo Err_CmdMonthVals_Click
Dim intButSelected As Integer, intButType As Integer
Dim strMsgPrompt As String, strMsgTitle As String
strMsgPrompt = "This action will be logged, and an alert sent to the administrator. Continue?"
strMsgTitle = "Restricted Access"
intButType = vbYesNo + vbInformation + vbDefaultButton2
intButSelected = msgbox(strMsgPrompt, intButType, strMsgTitle)
If intButSelected = vbYes Then
DoCmd.SetWarnings False
'I want to call the SendMail module HERE!!
DoCmd.OpenQuery "QryGraphData", acNormal, acEdit
Call Shell("""C:\Program Files\Microsoft Office\Office\EXCEL.EXE"" ""path to file.xls""", 1)
Exit_CmdMonthVals_Click:
Exit Sub
Err_CmdMonthVals_Click:
msgbox Err.Description
Resume Exit_CmdMonthVals_Click
DoCmd.SetWarnings True
End If
Exit Sub
End If
End If
End Sub