R
Rick
I need your advice with a problem users are having with the following code.
If they cancel anything (spellcheck or send) the mde will not run after it
has been closed necessitating a fresh copy of the mde to be installed. And,
at times, even if nothing has been cancelled and the 2 reports have been
sent, upon running the mde the next time, it reports a message that the
email was cancelled.
The report and excel file are received OK when they do a send on the email
screen.
Am I required to close something here?
Environment: mdb/mde is Access 2000 format running under Access2003
(unconverted). But the same thing is happening for clients using 2000. As
well, the Jet has been updated to v8.
Thanks for you help.
... rick
Private Sub cmdEmail_Click()
On Error GoTo Err_cmdEmail_Click
Dim InstID, InstName As String
Dim dteMax As Date
InstID = DLookup("InstID", "tblInstitutions", "[OwnerCode] = True")
InstName = DLookup("InstName", "tblInstitutions", "[OwnerCode] = True")
dteMax = DMax("RegistrationDate", "tblClients")
DoCmd.SendObject objecttype:=acReport, objectname:="rptQuickStats",
outputformat:=acFormatRTF, subject:=InstName & " Statistics Report",
messagetext:="Site " & InstID & " Registrations to " & dteMax
DoCmd.SendObject objecttype:=acSendQuery, objectname:="qryExportCPXX",
outputformat:=acFormatXLS, subject:=InstName & " Database Extract",
messagetext:="Site " & InstID & " Registrations to " & dteMax
Exit_cmdEmail_Click:
Exit Sub
Err_cmdEmail_Click:
MsgBox "E-mail action has been canceled. " &vbCRLF & Err.Description
Resume Exit_cmdEmail_Click
End Sub
If they cancel anything (spellcheck or send) the mde will not run after it
has been closed necessitating a fresh copy of the mde to be installed. And,
at times, even if nothing has been cancelled and the 2 reports have been
sent, upon running the mde the next time, it reports a message that the
email was cancelled.
The report and excel file are received OK when they do a send on the email
screen.
Am I required to close something here?
Environment: mdb/mde is Access 2000 format running under Access2003
(unconverted). But the same thing is happening for clients using 2000. As
well, the Jet has been updated to v8.
Thanks for you help.
... rick
Private Sub cmdEmail_Click()
On Error GoTo Err_cmdEmail_Click
Dim InstID, InstName As String
Dim dteMax As Date
InstID = DLookup("InstID", "tblInstitutions", "[OwnerCode] = True")
InstName = DLookup("InstName", "tblInstitutions", "[OwnerCode] = True")
dteMax = DMax("RegistrationDate", "tblClients")
DoCmd.SendObject objecttype:=acReport, objectname:="rptQuickStats",
outputformat:=acFormatRTF, subject:=InstName & " Statistics Report",
messagetext:="Site " & InstID & " Registrations to " & dteMax
DoCmd.SendObject objecttype:=acSendQuery, objectname:="qryExportCPXX",
outputformat:=acFormatXLS, subject:=InstName & " Database Extract",
messagetext:="Site " & InstID & " Registrations to " & dteMax
Exit_cmdEmail_Click:
Exit Sub
Err_cmdEmail_Click:
MsgBox "E-mail action has been canceled. " &vbCRLF & Err.Description
Resume Exit_cmdEmail_Click
End Sub