Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > File I/O and Registry > Runtime error '63'. Bad Record Number


Reply
 
Thread Tools Display Modes
  #1  
Old 04-26-2007, 08:08 PM
unclebill unclebill is offline
Junior Contributor
 
Join Date: Apr 2003
Location: San Diego, CA
Posts: 305
Default Runtime error '63'. Bad Record Number


I get this error occasionally in the executable program. It has NEVER occurred in the IDE. The error description I found on line says it indicates the record number in a Get/Put statement is =<0.

The error inevitably occurs in the same sequence of user actions. I select a source file from which data is to be imported, This file is a comma delimited ASCII text file.

Then I identify the output file names. Once I click the command button to execute the process, the error occurs.

There are only 3 Put statements in the program and two of them are in this process.

I have put error trapping code around each of the Put statements and the error trap is never activated.

Does anyone know of anything other than a Get/Put statement that can generate this error?
Reply With Quote
  #2  
Old 04-26-2007, 09:40 PM
webbone's Avatar
webbone webbone is offline
Hydrogen Powered

Administrator
* Expert *
 
Join Date: Jul 2003
Location: Sacramento, CA
Posts: 6,090
Default

I don't know of anything that would cause such an error - could you post the code that your Command Button executes so we may help you better? And if the code that Opens any of the files is not in the Command Button please show that as well.
__________________
"With the appearance of the AddressOf operator, an entire industry has developed among authors illustrating how to do previously impossible tasks using Visual Basic. Another industry is rapidly developing among consultants helping users who have gotten into trouble attempting these tasks." -Dan Appleman
Reply With Quote
  #3  
Old 04-26-2007, 10:36 PM
webbone's Avatar
webbone webbone is offline
Hydrogen Powered

Administrator
* Expert *
 
Join Date: Jul 2003
Location: Sacramento, CA
Posts: 6,090
Default

Additionally, have you thoroughly read the MSDN notes on this error:

Quote:
Originally Posted by MSDN
The record number in a Put or Get statement is less than or equal to zero.
Check the calculations used in generating the record number. Make sure that the variables containing the record number or used in calculating record numbers are spelled correctly. A misspelled variable name is implicitly declared and initialized to zero, unless you have properly placed Option Explicit in the module.
If you don't have Option Explicit set, you are in big trouble (makes like a living hell trying to debug ANYTHING).

In addition to your error handling code, have you tried STEPPING through your code and inspecting your variables as you go?
__________________
"With the appearance of the AddressOf operator, an entire industry has developed among authors illustrating how to do previously impossible tasks using Visual Basic. Another industry is rapidly developing among consultants helping users who have gotten into trouble attempting these tasks." -Dan Appleman
Reply With Quote
  #4  
Old 04-27-2007, 12:26 AM
unclebill unclebill is offline
Junior Contributor
 
Join Date: Apr 2003
Location: San Diego, CA
Posts: 305
Default

Option Explicit is set in each module.

The error only occurs in the executable. And then it only occurs when the program is executed from a directory other than the directory to which it is installed, e.g., the program and a couple of essential files are copied to another directory.

I have never been able to generate the error in the IDE.

The record number for the Put statement is not calculated: it is set to 1 for each file to be written and is incremented after the Put statement is executed. The loop is terminated when the input file (sequential access comma delimited) reaches EOF.
Reply With Quote
  #5  
Old 04-28-2007, 07:27 PM
RoofRabbit's Avatar
RoofRabbit RoofRabbit is offline
Contributor
 
Join Date: Sep 2003
Location: Lenoir, NC - USA
Posts: 731
Default

You might be trying to read a record past the end of the file. Is the record file an exact copy of the one in the source directory? I suspect there's a difference from the 2 files since you are only having problems in one directory and not the other.
__________________
Website http://roofrabbit.com/
Reply With Quote
  #6  
Old 04-29-2007, 11:59 PM
webbone's Avatar
webbone webbone is offline
Hydrogen Powered

Administrator
* Expert *
 
Join Date: Jul 2003
Location: Sacramento, CA
Posts: 6,090
Default

unclebill -

Once again, can you POST the code in your Command Button that seems to be causing the problem? We are just stabbing blindly and generally without addressing a specific code issue...
__________________
"With the appearance of the AddressOf operator, an entire industry has developed among authors illustrating how to do previously impossible tasks using Visual Basic. Another industry is rapidly developing among consultants helping users who have gotten into trouble attempting these tasks." -Dan Appleman
Reply With Quote
  #7  
Old 04-30-2007, 04:16 PM
Roger_Wgnr's Avatar
Roger_Wgnr Roger_Wgnr is offline
CodeASaurus Hex

Forum Leader
* Expert *
 
Join Date: Jul 2006
Location: San Antonio TX
Posts: 2,427
Default

This might be a clue as to the problem.
Quote:
And then it only occurs when the program is executed from a directory other than the directory to which it is installed
but without seeing your code no real way to tell.
__________________
Code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. ~Martin Golding
The user is a peripheral that types when you issue a read request. ~Peter Williams
MSDN Visual Basic .NET General FAQ
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->