473,503 Members | 5,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bad Length error - Very Urgent

9 New Member
Hi

When I'm trying to write data to a file from a custom variable(contains group of string items) it is giving me Runtime Error 59: bad record length.

Put #1, , ee_rec20 --this is the line which is giving the error

Kindly respond to this. I've to generate the file in an hour, please.

Regards,
Vinay
Feb 20 '07 #1
4 3293
Killer42
8,435 Recognized Expert Expert
Hi

When I'm trying to write data to a file from a custom variable(contains group of string items) it is giving me Runtime Error 59: bad record length.

Put #1, , ee_rec20 --this is the line which is giving the error

Kindly respond to this. I've to generate the file in an hour, please.
Sorry if it's too late now, but can you show us the definition of ee_rec20?
And how is the file opened - for Binary or Random? Posting the Open statement would probably help.
Feb 21 '07 #2
Killer42
8,435 Recognized Expert Expert
Also, have you read the doco on this error?

Bad record length (Error 59)

The length of a recordvariable in a Get or Put statement must be the length specified in its corresponding Open statement. This error has the following causes and solutions:
  • The record variable's length differs from the length specified in the corresponding Open statement.
    Make sure the sum of the sizes of fixed-lengthvariables in theuser-defined type defining the record variable's type is the same as the value stated in the Open statement's Len clause. In the following example, assume RecVar is a variable of the appropriate type. You can use the Len function to specify the length, as follows:
    Expand|Select|Wrap|Line Numbers
    1. Open MyFile As #1 Len = Len(RecVar)
  • The variable in a Put statement is (or includes) a variable-length string.
    Because a 2-byte descriptor is always added to a variable-length string placed in a random access file with Put, the variable-length string must be at least 2 characters shorter than the record length specified in the Len clause of the Open statement.

  • The variable in a Put statement is (or includes) a Variant.
    Like variable-length strings,Variant data types also require a 2-byte descriptor. Variants containing variable-length strings require a 4-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.
Feb 21 '07 #3
Garimella
9 New Member
Hi Killer42,

Thank you very much for the help. I solved it yesterday itself. Yes it was because of the definition of length. It was declared as 600 characters whereas the final output has 619 characters. That's not the end of the story.. i've one more issue. Now few records are having lot of spaces inthe front because of which the file looks unorganized. can you please help me. it's looking like this.
Expand|Select|Wrap|Line Numbers
  1.                                    000034330000 ........................(this is having lot of spaces before...)
  2. 090090000 txtfior....
  3. 090090000 txtfior....
  4. 090090000 txtfior....
  5.                                    000034330000 ........................
Feb 21 '07 #4
Killer42
8,435 Recognized Expert Expert
Glad to hear you resolved the first problem.

As for the spaces, I think we'd need to see the code which wrote that data. Quick question, though - are you sure you don't just have those spaces in the variable that you're writing?
Feb 21 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4125
by: XML newbie: Urgent pls help! | last post by:
I am using VB.Net. My program is to connect to a remote IPAddress. Once, it verifies the login information it should display the SessionID and enable some button . I appreciate your help and thanku...
2
2659
by: Nalaka | last post by:
Hi, I get the following error, I thought at random intervals. Then I realized, that this happens around the time tha page outputCache is set to expire. So I disabled the page output cache and the...
4
6791
by: Jason Richmeier | last post by:
I am sure this has been asked at least once before but I could not find anything when searching. If I set the value of the ExitCode property to 1066 for a windows service, the text "A service...
1
2085
by: psantosh12 | last post by:
Hello Frnds Please need help to resolve error.......... it is very very urgent........ The error is Runtime Error Description: An application error occurred on the server. The current custom...
6
1986
by: =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post by:
Hi - I have 4 webservers in my webfarm. All Win2k3 web edition. Before yesterday, none of them were service packed. I have now applied SP2 to two of them, and I'm getting a very weird MSDTC...
9
2068
by: Trapulo | last post by:
Hello, with ASP.NET 2.0 Ajax every unexpected error is managed client-side with a popup that reports the error to the user. In ASP.NET 3.5 this behavor has been changed: how can I have a similar...
2
9820
by: selvamariappan | last post by:
Hi all , I am using encryption to encrypt the query string passed from one page to other. In works fine most of the time but occationally i get this error - The line that throws that...
2
4206
by: Steven Cheng | last post by:
Hi Gary, As for the setting you mentioned, it is used to custimze the received data size limitation of WCF binding(such as NetTcpBinding or HttpBinding). After you have definite a customized...
7
16248
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am using this code to get groups for a user and getting a error (5) on the GetAuthorizationGroups() function . There are two domains. This function works on the local domain but does not work...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7441
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3156
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1489
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.