ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unexplained "Bad Record Length" error / bug? (https://www.excelbanter.com/excel-programming/358495-unexplained-bad-record-length-error-bug.html)

Dave[_66_]

Unexplained "Bad Record Length" error / bug?
 
As an experienced VB programmer, I understand the normal causes of the
Bad Record Length error. I am stumped on this though and believe it to
be some kind of bug in VBA...

I have several user-defined data types which I use to Put/Get data to
and from random-access files. Occasionally I get the "Bad Record
Length" run-time error. There is no apparent reason for this error
occuring, it is intermittent, and can be resolved by the following
process:

- comment-out an element within the data type
- attempt to run a procedure that includes a reference to this element
(this obviously causes a compile-time error "Method or data member not
found")
- end code execution
- reinstate declaration of the element

This process, in effect, forces VBA to recompile / rebuild the data
type, and everything runs fine again.

Anyone have an explanation?



All times are GMT +1. The time now is 04:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com