Unhandled Exception after running code on _Updated event

  • Thread starter Thread starter Fly Girl
  • Start date Start date
F

Fly Girl

After running code in the ctl_Updated event of an bound
OLE field I get an unhandled application error. The same
code runs fine outside of the event.

Where do I start?

Thanks for your help!
 
Hi,

Could you please post the code and the exact error with illustration?


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.



--------------------
| Content-Class: urn:content-classes:message
| From: "Fly Girl" <[email protected]>
| Sender: "Fly Girl" <[email protected]>
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| After running code in the ctl_Updated event of an bound
| OLE field I get an unhandled application error. The same
| code runs fine outside of the event.
|
| Where do I start?
|
| Thanks for your help!
|
 
Hi Alick,

You're awfully patient with my endless posts. It would be
too unwieldy to post the whole thing here. There is not a
particular line of code that errors. After running several
pages of code, flipping back and forth between all kinds
of functions, triggering events that have code behind
them, etc., the error occurs after running the line "Exit
Sub" of the event (_Updated event of a bound OLE control)
that started the whole mess. At that time there is no
error.

The exact error text is as follows:

Message 1: MSACCESS.EXE - Application Error 'The
instruction at "0x30226858" referenced memory
at "0x0e5d1a9c". The memory could not be "written".'

(The exact location of memory that can't be 'written'
changes with each run, of course.)

Message 2: Microsoft Visual C++ "Unhandled exception in
MSACCESS.EXE: 0xC0000005: Access Violation."

Clicking OK on the second message takes me to line
30226858 of the application.

I'll send you the actual code via email.

Thanks for your help!
 
Hi,

Based on your message, my first thought is that there could be some process
interrupting the normal operation of your application. We can reboot the
system into safe mode and run the code several times to see if the issue
occurs; we also need to pay attention to the printer driver since the
reports work close with the printer driver. There are some articles below
that help us to perform the "finding abnormal process" troubleshooting
method.

Windows Safe Mode:
============
315222 A Description of the Safe Mode Boot Options in Windows XP
http://support.microsoft.com/?id=315222

202485 Description of Safe Boot Mode in Windows 2000
http://support.microsoft.com/?id=202485

Windows Clean Boot:
============
310353 How to Perform a Clean Boot in Windows XP
http://support.microsoft.com/?id=310353

316434 HOW TO: Perform Advanced Clean-Boot Troubleshooting in Windows XP
http://support.microsoft.com/?id=316434

310560 How to Troubleshoot By Using the Msconfig Utility in Windows XP
http://support.microsoft.com/?id=310560

267288 How to Perform a Clean Boot in Windows Millennium Edition
http://support.microsoft.com/?id=267288

Please feel free to reply to the threads if you have any questions or
concerns.



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.


--------------------
| Content-Class: urn:content-classes:message
| From: "Fly Girl" <[email protected]>
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| Hi Alick,
|
| You're awfully patient with my endless posts. It would be
| too unwieldy to post the whole thing here. There is not a
| particular line of code that errors. After running several
| pages of code, flipping back and forth between all kinds
| of functions, triggering events that have code behind
| them, etc., the error occurs after running the line "Exit
| Sub" of the event (_Updated event of a bound OLE control)
| that started the whole mess. At that time there is no
| error.
|
| The exact error text is as follows:
|
| Message 1: MSACCESS.EXE - Application Error 'The
| instruction at "0x30226858" referenced memory
| at "0x0e5d1a9c". The memory could not be "written".'
|
| (The exact location of memory that can't be 'written'
| changes with each run, of course.)
|
| Message 2: Microsoft Visual C++ "Unhandled exception in
| MSACCESS.EXE: 0xC0000005: Access Violation."
|
| Clicking OK on the second message takes me to line
| 30226858 of the application.
|
| I'll send you the actual code via email.
|
| Thanks for your help!
|
| >-----Original Message-----
| >Hi,
| >
| >Could you please post the code and the exact error with
| illustration?
| >
| >
| >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.
| >
| >
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "Fly Girl" <[email protected]>
| >| Sender: "Fly Girl" <[email protected]>
| >| X-Tomcat-NG: microsoft.public.access.formscoding
| >|
| >| After running code in the ctl_Updated event of an bound
| >| OLE field I get an unhandled application error. The
| same
| >| code runs fine outside of the event.
| >|
| >| Where do I start?
| >|
| >| Thanks for your help!
| >|
| >
| >.
| >
|
 
Thanks Alick,

I tried running the code in Safe Mode on Win2K and it
still crashed the application.

Currently this failure leaves a small hole in my document
control process in that there is one instance of user
actions that I cannot control. The only way that I would
end up running the code that causes this crash is if the
user does a 'Save As' in Word and saves the document to a
different name.

Is there any way of disabling the 'Save As' feature of
Word when opened via Access as an OLE Server? Or is there
any setting I can make so that when the user does a 'Save
As' on Win2K that the link in the OLE field in the
database will continue to point to the original file
instead of being replaced with a link to the new file?

Note: this is not an issue in XP as in XP the link will
remain with the original file and not with file created by
the 'Save As'.

Also, please note that there is no report involved in this
process. Forms only at this point.

Thanks for your help!
 
Hi,

The crashing issue is usually hard to troubleshooting, if disabling the
Save As menu can resolve your issue, we can try CommandBarControl object to
access the Save as menu and disable it. Below is s ample for your reference;


Dim wordApp As Word.Application

Dim ctrl As CommandBarControl

Set wordApp = CreateObject("Word.Application")

With wordApp

.WindowState = wdWindowStateMaximize
.Documents.Add

End With

wordApp.Visible = True

Set ctrl = wordApp.CommandBars("Menu
Bar").Controls("File").Controls("Save as...")

ctrl.Enabled = False

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.


--------------------
| Content-Class: urn:content-classes:message
| From: "Fly Girl" <[email protected]>
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| Thanks Alick,
|
| I tried running the code in Safe Mode on Win2K and it
| still crashed the application.
|
| Currently this failure leaves a small hole in my document
| control process in that there is one instance of user
| actions that I cannot control. The only way that I would
| end up running the code that causes this crash is if the
| user does a 'Save As' in Word and saves the document to a
| different name.
|
| Is there any way of disabling the 'Save As' feature of
| Word when opened via Access as an OLE Server? Or is there
| any setting I can make so that when the user does a 'Save
| As' on Win2K that the link in the OLE field in the
| database will continue to point to the original file
| instead of being replaced with a link to the new file?
|
| Note: this is not an issue in XP as in XP the link will
| remain with the original file and not with file created by
| the 'Save As'.
|
| Also, please note that there is no report involved in this
| process. Forms only at this point.
|
| Thanks for your help!
|
 
Hi Alick,

Thanks for hanging in there with me on this one. Yesterday
I spent pretty much the entire morning just happily
crashing Access and came to the conclusion that it always
runs all the code first so, in the end, it is only an
inconvenience for the user.

Whatever it is, it's very consistent on my machine! Today
I have an opportunity to see what happens on XP.

I will consider manually creating the instance of Word and
disabling Save As. Right now I'm feeling a bit evil and
thinking of just sending a message to the user explaining
that they have been VERY bad and will now have to re-start
the application... heh, heh...

What can I say, it's Tuesday and there are still 4 more
days of slogging through this ahead of me.

Thanks again!
Gail
 
Hi Alick,

I had a chance to try your code suggestion and wanted to
give you some feedback.

1) What you sent didn't quite work. What did work was:

Set ctrl = wordapp.CommandBars("File").Controls("Save
as...")

2) If you send this code to someone else, it would be nice
to include information regarding what reference needs to
be set in order to use it. It was pretty obvious that I
needed to set an application reference, but it wasn't
obvious which reference would work. I eventually figured
out by searching coding sites that I needed a reference to
MS Office.
 
Oops! There was a third thing.

3) It is really important to point out that doing this
will disable the commandbarcontrol for the application in
all instances until code is run to enable the control.

Hope I save someone else some frustration!

Thanks again.
GS
 
Hi,

Thanks for your feedback.

I am not sure why the code doesn't work on your side.

Set ctrl = wordApp.CommandBars("Menu Bar").Controls("File").Controls("Save
as...")

However, the following code can be clearer about the object
module/hiberarchy.

Dim wordApp As Word.Application
Dim CBarMenu As CommandBar
Dim CBarCtl As CommandBarPopup
Dim ctl As CommandBarControl

Set wordApp = CreateObject("Word.Application")

With wordApp

.WindowState = wdWindowStateMaximize
.Documents.Add

End With

wordApp.Visible = True

Set CBarMenu = wordApp.CommandBars("Menu Bar")
Set CBarCtl = CBarMenu.Controls("File")
Set ctl = CBarCtl.Controls("Save as...")
ctl.Enabled = False


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.





--------------------
| Content-Class: urn:content-classes:message
| From: "Fly Girl" <[email protected]>
| Sender: "Fly Girl" <[email protected]>
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| Hi Alick,
|
| Thanks for hanging in there with me on this one. Yesterday
| I spent pretty much the entire morning just happily
| crashing Access and came to the conclusion that it always
| runs all the code first so, in the end, it is only an
| inconvenience for the user.
|
| Whatever it is, it's very consistent on my machine! Today
| I have an opportunity to see what happens on XP.
|
| I will consider manually creating the instance of Word and
| disabling Save As. Right now I'm feeling a bit evil and
| thinking of just sending a message to the user explaining
| that they have been VERY bad and will now have to re-start
| the application... heh, heh...
|
| What can I say, it's Tuesday and there are still 4 more
| days of slogging through this ahead of me.
|
| Thanks again!
| Gail
|
| >-----Original Message-----
| >Hi,
| >
| >The crashing issue is usually hard to troubleshooting, if
| disabling the
| >Save As menu can resolve your issue, we can try
| CommandBarControl object to
| >access the Save as menu and disable it. Below is s ample
| for your reference;
| >
| >
| > Dim wordApp As Word.Application
| >
| > Dim ctrl As CommandBarControl
| >
| > Set wordApp = CreateObject("Word.Application")
| >
| > With wordApp
| >
| > .WindowState = wdWindowStateMaximize
| > .Documents.Add
| >
| > End With
| >
| > wordApp.Visible = True
| >
| > Set ctrl = wordApp.CommandBars("Menu
| >Bar").Controls("File").Controls("Save as...")
| >
| > ctrl.Enabled = False
| >
| >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.
| >
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "Fly Girl" <[email protected]>
| >| X-Tomcat-NG: microsoft.public.access.formscoding
| >|
| >| Thanks Alick,
| >|
| >| I tried running the code in Safe Mode on Win2K and it
| >| still crashed the application.
| >|
| >| Currently this failure leaves a small hole in my
| document
| >| control process in that there is one instance of user
| >| actions that I cannot control. The only way that I
| would
| >| end up running the code that causes this crash is if
| the
| >| user does a 'Save As' in Word and saves the document to
| a
| >| different name.
| >|
| >| Is there any way of disabling the 'Save As' feature of
| >| Word when opened via Access as an OLE Server? Or is
| there
| >| any setting I can make so that when the user does
| a 'Save
| >| As' on Win2K that the link in the OLE field in the
| >| database will continue to point to the original file
| >| instead of being replaced with a link to the new file?
| >|
| >| Note: this is not an issue in XP as in XP the link will
| >| remain with the original file and not with file created
| by
| >| the 'Save As'.
| >|
| >| Also, please note that there is no report involved in
| this
| >| process. Forms only at this point.
| >|
| >| Thanks for your help!
| >|
| >
| >.
| >
|
 
Hi,

It seems the crashing issue turns out be complex, if you would, I suggest
you to contact Microsoft Product Support Services at:
http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

A dedicated Support Professional will assistant you to resolve the issue.



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.

--------------------
| Content-Class: urn:content-classes:message
| From: <[email protected]>
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| Well, in the end it doesn't matter. This code:
|
| Set ctrl = wordApp.CommandBars("Menu Bar").Controls("Save
| as...")
|
| ctrl.Enabled = False
|
| works a little too well in that it disables Save as in all
| instances of word until I run code to enable it. Since
| Access is a little flaky about catching when an OLE object
| is closed I'm afraid to implement this. I think I'll just
| give them the old 'you were bad and now you must pay'
| message box and let it crash.
|
| Today I had a chance to run my code on an XP box w/ Office
| 2002. Access still crashes. In addition, in this scenario
| I tried a 'Save As Web Page' and cause an equally
| interesting problem. Since Internet Explorer is not
| enabled as an OLE Server the file, which is happily
| converted to a .htm file, is no longer accessible from the
| OLE container control. It's always something...
|
|
| >-----Original Message-----
| >Hi,
| >
| >Thanks for your feedback.
| >
| >I am not sure why the code doesn't work on your side.
| >
| >Set ctrl = wordApp.CommandBars("Menu Bar").Controls
| ("File").Controls("Save
| >as...")
| >
| >However, the following code can be clearer about the
| object
| >module/hiberarchy.
| >
| > Dim wordApp As Word.Application
| > Dim CBarMenu As CommandBar
| > Dim CBarCtl As CommandBarPopup
| > Dim ctl As CommandBarControl
| >
| > Set wordApp = CreateObject("Word.Application")
| >
| > With wordApp
| >
| > .WindowState = wdWindowStateMaximize
| > .Documents.Add
| >
| > End With
| >
| > wordApp.Visible = True
| >
| > Set CBarMenu = wordApp.CommandBars("Menu Bar")
| > Set CBarCtl = CBarMenu.Controls("File")
| > Set ctl = CBarCtl.Controls("Save as...")
| > ctl.Enabled = False
| >
| >
| >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.
| >
| >
| >
| >
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "Fly Girl" <[email protected]>
| >| Sender: "Fly Girl" <[email protected]>
| >| X-Tomcat-NG: microsoft.public.access.formscoding
| >|
| >| Hi Alick,
| >|
| >| Thanks for hanging in there with me on this one.
| Yesterday
| >| I spent pretty much the entire morning just happily
| >| crashing Access and came to the conclusion that it
| always
| >| runs all the code first so, in the end, it is only an
| >| inconvenience for the user.
| >|
| >| Whatever it is, it's very consistent on my machine!
| Today
| >| I have an opportunity to see what happens on XP.
| >|
| >| I will consider manually creating the instance of Word
| and
| >| disabling Save As. Right now I'm feeling a bit evil and
| >| thinking of just sending a message to the user
| explaining
| >| that they have been VERY bad and will now have to re-
| start
| >| the application... heh, heh...
| >|
| >| What can I say, it's Tuesday and there are still 4 more
| >| days of slogging through this ahead of me.
| >|
| >| Thanks again!
| >| Gail
| >|
| >| >-----Original Message-----
| >| >Hi,
| >| >
| >| >The crashing issue is usually hard to troubleshooting,
| if
| >| disabling the
| >| >Save As menu can resolve your issue, we can try
| >| CommandBarControl object to
| >| >access the Save as menu and disable it. Below is s
| ample
| >| for your reference;
| >| >
| >| >
| >| > Dim wordApp As Word.Application
| >| >
| >| > Dim ctrl As CommandBarControl
| >| >
| >| > Set wordApp = CreateObject("Word.Application")
| >| >
| >| > With wordApp
| >| >
| >| > .WindowState = wdWindowStateMaximize
| >| > .Documents.Add
| >| >
| >| > End With
| >| >
| >| > wordApp.Visible = True
| >| >
| >| > Set ctrl = wordApp.CommandBars("Menu
| >| >Bar").Controls("File").Controls("Save as...")
| >| >
| >| > ctrl.Enabled = False
| >| >
| >| >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.
| >| >
| >| >
| >| >--------------------
| >| >| Content-Class: urn:content-classes:message
| >| >| From: "Fly Girl" <[email protected]>
| >| >| X-Tomcat-NG: microsoft.public.access.formscoding
| >| >|
| >| >| Thanks Alick,
| >| >|
| >| >| I tried running the code in Safe Mode on Win2K and
| it
| >| >| still crashed the application.
| >| >|
| >| >| Currently this failure leaves a small hole in my
| >| document
| >| >| control process in that there is one instance of
| user
| >| >| actions that I cannot control. The only way that I
| >| would
| >| >| end up running the code that causes this crash is if
| >| the
| >| >| user does a 'Save As' in Word and saves the document
| to
| >| a
| >| >| different name.
| >| >|
| >| >| Is there any way of disabling the 'Save As' feature
| of
| >| >| Word when opened via Access as an OLE Server? Or is
| >| there
| >| >| any setting I can make so that when the user does
| >| a 'Save
| >| >| As' on Win2K that the link in the OLE field in the
| >| >| database will continue to point to the original file
| >| >| instead of being replaced with a link to the new
| file?
| >| >|
| >| >| Note: this is not an issue in XP as in XP the link
| will
| >| >| remain with the original file and not with file
| created
| >| by
| >| >| the 'Save As'.
| >| >|
| >| >| Also, please note that there is no report involved
| in
| >| this
| >| >| process. Forms only at this point.
| >| >|
| >| >| Thanks for your help!
| >| >|
| >| >
| >| >.
| >| >
| >|
| >
| >.
| >
|
 
Back
Top