Hi Dwayne,
Glad we made some process, is the modified code the final code you want? Or
is it acceptable? If not, you may need to find the exact code line that
causes the issue.
I tested the code, but it works fine.
foo = Combo1.Value
foobar = "Attached to this e-mail please find a copy of report number "
& Combo1.Text & ", in Microsoft Word format."
DoCmd.OpenReport "temp_received", acViewDesign
Reports("temp_received").Caption = Combo1.Text
DoCmd.Close acReport, "temp_received", acSaveYes
DoCmd.SendObject acOutputReport, "temp_received", acFormatRTF, , , ,
Combo1.Text, foobar, 0
DoCmd.RunCommand acCmdCloseWindow
You may create a new database and import all the related objects into the
new database, and then check to see if the issue still occurs.
Please feel free to reply to the threads if you have any questions.
Sincerely,
Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <
www.microsoft.com/security>
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Reply-To: "Dwayne Conyers" <
[email protected]>
| From: "Dwayne Conyers" <
[email protected]>
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| Alick
| I was able to stop the errors by commenting out several lines:
| Private Sub Combo7_BeforeUpdate(Cancel As Integer)
| On Error Resume Next
| foo = Combo7.Value
| bar = "Select Report from Record # " & Trim(Str(foo))
| foobar = "Attached to this e-mail please find a copy of report number
" & Combo7.Text & ", in Microsoft Word format."
|
| newSQL = "SELECT classification.classification,
Received_Reports.Report_Number, Received_Reports.Subject,
Received_Reports.Date_of_Entry, [prep_office].[office] & ', ' &
[Received_Reports].[Preparer] AS the_preparer, Received_Reports.Contact,
Report_Types.report_type INTO temp_received FROM ((Received_Reports LEFT
JOIN classification ON Received_Reports.Classification_Key =
classification.classID) LEFT JOIN Report_Types ON
Received_Reports.Report_Type = Report_Types.rpt_type_id) LEFT JOIN
prep_office ON Received_Reports.Preparer_Office_Key = prep_office.id WHERE
(((Received_Reports.rrID)=" & Trim(Str(foo)) & "));"
|
| DoCmd.SetWarnings False
| DoCmd.RunSQL newSQL
| DoCmd.SetWarnings True
|
| 'DoCmd.OpenReport "temp_received", acViewDesign
| 'Reports("temp_received").Caption = Combo7.Text
| 'DoCmd.Close acReport, "temp_received", acSaveYes
|
| DoCmd.SendObject acOutputReport, "temp_received", acFormatRTF, , , ,
Combo7.Text, foobar, 0
|
| 'DoCmd.RunCommand acCmdCloseWindow
|
| End Sub
| > Hi Dwayne,
| >
| > When you set EditMessage parameter to false, the user doesn't have the
option to choose the cancel action, does the issue still occur? Could you
| > confirm it?
| >
| > I tested it on more machines and it works fine.
| >
| > Private Sub Combo1_BeforeUpdate(Cancel As Integer)
| >
| > On Error Resume Next
| > DoCmd.SendObject acOutputReport, "Employees", acFormatRTF, , , ,
Combo1.Text
| >
| > End Sub
| >
| > The client has the same Outlook version (2002 sp2);
| >
| > According my research, I have some ideas to troubleshooting the issue:
| >
| > 1. Reinstall/Repair client email program via Control Panel->Add/Remove
| >
| > 2. For testing purpose, simplifying your code, just add one form, one
| > combox box, and in beforeupdate event, add only two lines as above,
check
| > to see if the issue occurs, if it doesn't it may be related to other
code.
| >
| > 3. Try to apply the latest Jet update:
| >
| > ACC2002: Updated Version of Microsoft Jet 4.0 Available in Download
| >
http://support.microsoft.com/default.aspx?scid=KB;EN-US;282010
| >
| > ACC2000: Updated Version of Microsoft Jet 4.0 Available in Download
| >
http://support.microsoft.com/default.aspx?scid=KB;EN-US;239114
| >
| > Please feel free to reply to the threads if you have any concerns or
| > questions.
| >
| >
| >
| > Sincerely,
| >
| > Alick Ye, MCSD
| > Product Support Services
| > Microsoft Corporation
| > Get Secure! - <
www.microsoft.com/security>
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| >
| > --------------------
| > | Reply-To: "Dwayne Conyers" <
[email protected]>
| > | From: "Dwayne Conyers" <
[email protected]>
| > | X-Tomcat-NG: microsoft.public.access.formscoding
| > |
| > | We have the error appear on two machines: a laptop and a workstation.
We
| > | are using Microsoft Outlook 2002 (10.4712.4219) SP-2. We have no
access
| > to
| > | or influence over the Exchange server.
| > |
| > | Any other ideas would be appreciated.
| > |
| > | d.c.
| > |
| > |
| > | | > | > Hi Dwayne,
| > | >
| > | > The two line codes work on my side and it hasn't generate any
error, I
| > | > tested it on three computers. It seems it is most likely machine
| > specific;
| > | > since the method calls default email client program, you may have
the
| > | > clients check the default email client program (Outlook or Outlook
| > | Express,
| > | > etc) perhaps reinstallation of MAPI clients will resolve the error.
| > | >
| > | > On Error Resume Next
| > | > DoCmd.SendObject acOutputReport, "Employees", acFormatRTF, , , ,
| > | Combo1.Text
| > | >
| > | > However, the error message "the sendobject action was cancelled"
does
| > | > appear when there is no "On Error Resume Next" statement.
| > | >
| > | > In addition, when we set EditMessage parameter to be false, the
message
| > | > will be sent without editing, the user/client doesn't have the
chance to
| > | > cancel the action, which means it should always be sent. If the
same
| > error
| > | > stills occurs when EditMessage is false, I would think the
essential
| > cause
| > | > is not the user's action, it is possible that the client MAPI
program is
| > | > corrupt, reinstallation could be a quick method to have a try.
| > | >
| > | >
| > | >
| > | > Sincerely,
| > | >
| > | > Alick Ye, MCSD
| > | > Product Support Services
| > | > Microsoft Corporation
| > | > Get Secure! - <
www.microsoft.com/security>
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > | rights.
| > | >
| > | >
| > | > --------------------
| > | > | Reply-To: "Dwayne Conyers" <
[email protected]>
| > | > | X-Tomcat-NG: microsoft.public.access.formscoding
| > | > |
| > | > | Alick
| > | > |
| > | > | The error occurs when the created e-mail message is closed without
| > | > sending.
| > | > | If you send the e-mail no error.
| > | > |
| > | > | Tried setting the optional variant to False (0) but the error
still
| > | > | continues to appear.
| > | > |
| > | > |
| > | > |
| > | > | | > | > | > Hi Dwayne,
| > | > | >
| > | > | > On the problematic client, create a new database file, one form
with
| > | on
| > | > | > combo box control bounding to a table. On the before update
event,
| > | > simply
| > | > | > add two code line:
| > | > | >
| > | > | > Private Sub Combo1_BeforeUpdate(Cancel As Integer)
| > | > | >
| > | > | > On Error Resume Next
| > | > | > DoCmd.SendObject acOutputReport, "Employees", acFormatRTF, , , ,
| > | > | Combo1.Text
| > | > | >
| > | > | > End Sub
| > | > | >
| > | > | > Does the error occur?
| > | > | >
| > | > | > How about if you set the EditMessage parameter to be false?
| > | > | >
| > | > | > EditMessage Optional Variant. Use True (-1) to open the
electronic
| > | > mail
| > | > | > application immediately with the message loaded, so the message
can
| > be
| > | > | > edited. Use False (0) to send the message without editing it.
If you
| > | > leave
| > | > | > this argument blank, the default (True) is assumed.
| > | > | >
| > | > | >
| > | > | >
| > | > | > Sincerely,
| > | > | >
| > | > | > Alick Ye, MCSD
| > | > | > Product Support Services
| > | > | > Microsoft Corporation
| > | > | > Get Secure! - <
www.microsoft.com/security>
| > | > | >
| > | > | > This posting is provided "AS IS" with no warranties, and
confers no
| > | > | rights.
| > | > | >
| > | > | > --------------------
| > | > | > | Reply-To: "Dwayne Conyers" <
[email protected]>
| > | > | > | From: "Dwayne Conyers" <
[email protected]>
| > | > | > | X-Tomcat-NG: microsoft.public.access.formscoding
| > | > | > |
| > | > | > | We have a form that generates an email with an attachment.
The
| > code
| > | > | > works fine, unless the user does something unexpected. First,
the
| > | code
| > | > we
| > | > | > are working with:
| > | > | > | <!-- CODE BELOW //-->
| > | > | > | Private Sub Combo7_BeforeUpdate(Cancel As Integer)
| > | > | > | On Error Resume Next
| > | > | > | foo = Combo7.Value
| > | > | > | bar = "Select Report from Record # " & Trim(Str(foo))
| > | > | > | foobar = "Attached to this e-mail please find a copy of
report
| > | > | number
| > | > | > " & Combo7.Text & ", in Microsoft Word format."
| > | > | > |
| > | > | > | newSQL = "SELECT classification.classification,
| > | > | > Received_Reports.Report_Number, Received_Reports.Subject,
| > | > | > Received_Reports.Date_of_Entry, [prep_office].[office] & ', ' &
| > | > | > [Received_Reports].[Preparer] AS the_preparer,
| > | Received_Reports.Contact,
| > | > | > Report_Types.report_type INTO temp_received FROM
((Received_Reports
| > | LEFT
| > | > | > JOIN classification ON Received_Reports.Classification_Key =
| > | > | > classification.classID) LEFT JOIN Report_Types ON
| > | > | > Received_Reports.Report_Type = Report_Types.rpt_type_id) LEFT
JOIN
| > | > | > prep_office ON Received_Reports.Preparer_Office_Key =
prep_office.id
| > | > | WHERE
| > | > | > (((Received_Reports.rrID)=" & Trim(Str(foo)) & "));"
| > | > | > |
| > | > | > | DoCmd.SetWarnings False
| > | > | > | DoCmd.RunSQL newSQL
| > | > | > | DoCmd.SetWarnings True
| > | > | > |
| > | > | > | DoCmd.OpenReport "temp_received", acViewDesign
| > | > | > | Reports("temp_received").Caption = Combo7.Text
| > | > | > |
| > | > | > | DoCmd.Close acReport, "temp_received", acSaveYes
| > | > | > | DoCmd.SendObject acOutputReport, "temp_received",
| > acFormatRTF, ,
| > | > , ,
| > | > | > Combo7.Text, foobar
| > | > | > | End Sub
| > | > | > | <!-- CODE ABOVE //-->
| > | > | > | Again, this works fine, except when the user changes his/her
mind
| > | and
| > | > | > instead of sending the mail, closes the email without sending.
We
| > get
| > | > the
| > | > | > following error, and then the application hangs:
| > | > | > | The SendObject action was canceled.
| > | > | > | You used a method of the DoCmd object to carry out an
action
| > in
| > | > | > Visual Basic, but then clicked Cancel in a dialog box. For
example,
| > | you
| > | > | > used the Close method to close a changed form, then clicked
Cancel
| > in
| > | > the
| > | > | > dialog box that asks if you want to save the changes you made
to
| > the
| > | > | form.
| > | > | > | The application freezes and will not accept any clicks. When
we
| > try
| > | > to
| > | > | > close, we get this error:
| > | > | > | You can't exit Reporting Database now.
| > | > | > | If you're running a Visual Basic module that is using OLE
or
| > | DDE,
| > | > | you
| > | > | > may need to interrupt the module.
| > | > | > | At this point, the only way to exit the application is to go
to
| > Task
| > | > | > Manager and shut down the process. Trying to find a solution
to
| > this
| > | > | > problem, as the user insists on having the right to change
their
| > mind
| > | > | after
| > | > | > generating an e-mail using this form.
| > | > | > | Thanks!
| > | > | > |
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|