Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


bad record length error


bad record length error

Author
Message
digitman
digitman
Forum God
Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)

Group: Forum Members
Posts: 48, Visits: 1

Hi guys,sorry for the late reply.

I had to increase the len to 10000 before it worked.And although i didnt get any error,the program added a lot of junk to the file with each record added.I printed the values being added using debug.print every time any data was added to the file and it printed only the correct values.But it added a lot of crap to the file which I saw nowhere in the debug window,hence a lot of trouble was caused when inputting from the file.Does anyone know what could be causing this?I'm outputting a user defined type that has 3 arrays of strings,and the arrays are redimensioned at runtime depending on what values the user provided.

thanks a lot.


brainfry
brainfry
Forum God
Forum God (923 reputation)Forum God (923 reputation)Forum God (923 reputation)Forum God (923 reputation)Forum God (923 reputation)Forum God (923 reputation)Forum God (923 reputation)Forum God (923 reputation)Forum God (923 reputation)

Group: Forum Members
Posts: 59, Visits: 4

One thing to remember. If you start a random access file out with a length of 852 and put data into it, if you change the len to say 1000 and then put more data into it, you will have scrambled junk in it. Dont ask me why. Anytime you increase the length of a random access file, you need to delete the previous file and start over with the new settings.

 

 



Hello World!
pso
pso
Forum God
Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)

Group: Forum Members
Posts: 794, Visits: 338

Bad record length (Error 59)

The length of a record variable for a Get or Put statement does not match the length specified in the corresponding Open statement. Because a two- byte descriptor is always added to a variable-length string Put to a random access file, the variable-length string must be at least two characters shorter than the record length specified in the Len clause of the Open statement.

Variant data types also require a two-byte descriptor. Variants containing variable-length strings require a four-byte descriptor. Therefore, for variable-length strings in a Variant, the string must be at least 4 bytes shorter than the record length specified in the Len clause.

 

from http://support.microsoft.com/default.aspx?scid=kb;en-us;Q142138 (trappable errors /vb(a)

I remembered something about udt's and strings. this is basically what i remembered.Maybe some readjustments on your string types will correct the bad rec len.

hope this helped.

 






Tongue

digitman
digitman
Forum God
Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)Forum God (6.8K reputation)

Group: Forum Members
Posts: 48, Visits: 1

I'm using new files built from scratch here,so this shouldnt be the reason.


GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search