By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,543 Members | 2,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,543 IT Pros & Developers. It's quick & easy.

memory could not be "written" when application terminates

P: n/a
Hello,

I have written an application in Visual Basic 6.0 Professional SP5 that
reads data from an Excel workbook by using ADO. When I close the
application, I get the error:

'The instruction at "0x01b302bd" referenced memory at "0xb52ad202". The
memory could not be "written"'

- this only happens with the compiled exe (both P-code and native code), but
not when I run the application in Visual Basic without compiling
- this only happens if the application has read data from the Excel workbook
- this happens with Windows 98se, Windows NT 4 and Windows XP

I'm using the MS ActiveX Data Object 2.7 Library.

Does someone has a clue what might cause the error?

Thanks in advance,

Geert-Pieter
Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Geert-Pieter Hof" <g.*******@wbmt.tudelft.nl.blablabla> wrote in message news:<bi**********@azure.qinip.net>...
Hello,

I have written an application in Visual Basic 6.0 Professional SP5 that
reads data from an Excel workbook by using ADO. When I close the
application, I get the error:

'The instruction at "0x01b302bd" referenced memory at "0xb52ad202". The
memory could not be "written"'

- this only happens with the compiled exe (both P-code and native code), but
not when I run the application in Visual Basic without compiling
- this only happens if the application has read data from the Excel workbook
- this happens with Windows 98se, Windows NT 4 and Windows XP

I'm using the MS ActiveX Data Object 2.7 Library.

Does someone has a clue what might cause the error?

Thanks in advance,

Geert-Pieter


It is likely that there are some object references left which VB can't
take care of. Try looking for circular references (Object A refers to
Object B and vice versa, or something similar) and break them by
explicitly setting the objects to Nothing. Note that Class_Terminate
or Form_Terminate event won't arrive in such a case, so you have to
remove the references earlier.

Robert
Jul 17 '05 #2

P: n/a
> I have written an application in Visual Basic 6.0 Professional SP5 that
reads data from an Excel workbook by using ADO. When I close the
application, I get the error:

'The instruction at "0x01b302bd" referenced memory at "0xb52ad202". The
memory could not be "written"'

- this only happens if the application has read data from the Excel

workbook

Problem solved!

The problem was a 3rd party component (Vertical Menu ActiveX Control from
WinResources) that had to be set back to its initial state before closing
the application. Altough this component has absolutely nothing to do with
reading and writing the Excel workbook via ADO, the 'memory could not be
"written"'-message only showed up after accessing the Excel workbook.

One last question:
The problem I had, is this an imperfection of the 3rd party component or of
Visual Basic 6.0?

Best regards,

Geert-Pieter
Jul 17 '05 #3

P: n/a
hex
"Geert-Pieter Hof" <g.*******@wbmt.tudelft.nl.blablabla> wrote in message news:<bj**********@azure.qinip.net>...
I have written an application in Visual Basic 6.0 Professional SP5 that
reads data from an Excel workbook by using ADO. When I close the
application, I get the error:

'The instruction at "0x01b302bd" referenced memory at "0xb52ad202". The
memory could not be "written"'

- this only happens if the application has read data from the Excel

workbook

Problem solved!

The problem was a 3rd party component (Vertical Menu ActiveX Control from
WinResources) that had to be set back to its initial state before closing
the application. Altough this component has absolutely nothing to do with
reading and writing the Excel workbook via ADO, the 'memory could not be
"written"'-message only showed up after accessing the Excel workbook.

One last question:
The problem I had, is this an imperfection of the 3rd party component or of
Visual Basic 6.0?

Best regards,

Geert-Pieter


We receive the same error from a similar application we have under
development and using the same control from WinResources. I'd be very
interested in what was done to eliminate this error. Any information
you have regarding what you had to do to set the control back to its
initial state would be of great help.

Thanks in advance for your help,

Andy
Jul 17 '05 #4

P: n/a
> > > I have written an application in Visual Basic 6.0 Professional SP5
that
reads data from an Excel workbook by using ADO. When I close the
application, I get the error:

'The instruction at "0x01b302bd" referenced memory at "0xb52ad202". The memory could not be "written"'
Problem solved!

The problem was a 3rd party component (Vertical Menu ActiveX Control from WinResources) that had to be set back to its initial state before closing the application.
We receive the same error from a similar application we have under
development and using the same control from WinResources. I'd be very
interested in what was done to eliminate this error. Any information
you have regarding what you had to do to set the control back to its
initial state would be of great help.


Private Sub Form_Unload(Cancel As Integer)

VerticalMenu1.MenuItemsMax = 0
VerticalMenu1.MenusMax = 0

End Sub

Putting these two lines of code in the Form_Unload will prevent the memory
could not be "written"-problem while unloading the Vertical Menu control.

Best regards,

Geert-Pieter
Jul 17 '05 #5

P: n/a
hex
"Geert-Pieter Hof" <g.*******@wbmt.tudelft.nl.blablabla> wrote in message news:<bj**********@azure.qinip.net>...
> I have written an application in Visual Basic 6.0 Professional SP5 that > reads data from an Excel workbook by using ADO. When I close the
> application, I get the error:
>
> 'The instruction at "0x01b302bd" referenced memory at "0xb52ad202". The > memory could not be "written"' Problem solved!

The problem was a 3rd party component (Vertical Menu ActiveX Control from WinResources) that had to be set back to its initial state before closing the application.

We receive the same error from a similar application we have under
development and using the same control from WinResources. I'd be very
interested in what was done to eliminate this error. Any information
you have regarding what you had to do to set the control back to its
initial state would be of great help.


Private Sub Form_Unload(Cancel As Integer)

VerticalMenu1.MenuItemsMax = 0
VerticalMenu1.MenusMax = 0

End Sub

Putting these two lines of code in the Form_Unload will prevent the memory
could not be "written"-problem while unloading the Vertical Menu control.

Best regards,

Geert-Pieter

We'll add the code you have listed.

Many thanks for the assistance!

Andy
Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.