Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

illegal value

Status
Not open for further replies.

jeromiby

Programmer
Nov 28, 2003
2
US
I need help for solving a problem of illegal value in Dbase IV on Win95. The code was running without trouble for a longtime but since few days I got "Illegal value" message. I tried different things but no solution.
 
You're gonna have to provide more info than this. Post the code that's executing when the problem occurs, some description of the data that's creating the problem, and in this case, whether anything has changed that you know of, and what things you have already tried.
 
I got this message when such a code is running:

SET DEVICE TO FILE c:\qgpl\fiches.rpt

SELECT B

DO while .NOT. EOF()
store line + 2 to line
@line, 12 SAY "DIVISION:" + b->divno
.......
.......
.......
SKIP
ENDDO
Close databases
Note that I got it for a few records of the database. I tied to replace the file fiches.rpt but no doesn't solve the problem.
 
When running this code:

1. are there any index files open? (try reindexing the file)
2. have you tried putting a "suspend" statement in the do/while loop to see where in the loop, and record, it's handing up at? (I'd put it right after the Do statement:

Do while .not. eof()
suspend

3. you could accomplish the same thing by printing to the screen what you're excpecting to see on the report.

Couple of other things to help with your code:

1. since you've already selected work area B, you don't need the [/b]b->[/b] file pointer.

2. define the variable "line" outside of the do/while loop. when you want to increment it, just use line= line + 2.

There's always a better way. The fun is trying to find it!
 
tviman makes a good suggestion. Set the suspend within the loop, look at the values of "line" and "b->divno" each suspend cycle. divno has to be a string for your @ SAY to execute correctly.. is there any way it's value could end up non-string? You could try changing that line of code to:

@line, 12 SAY "DIVISION:" + str(b->divno)

and see if that changes the behavior.


Also, I'm wondering about the length of divno. If it's extremely long, I'm wondering if the combined string "DIVISION:"+b->divno excedes an environment limit on column widths. I'm trying to remember if there is a SET COLUMNWIDTH parameter in this product/version or not.If there is, this may be what's being exceeded to yield the "illegal value" error.

hth
Dennis
 
Dennis also makes an excellent point. If the values held in divno are not character values, your program will throw-up everytime. You stated that you get a few records before the program stops. If, for example, the program stops at record #4, I'd look hard at the data in records 3,4,5, & 6.

If the data is corrupted, look at the program that allows data to be entered into the divno field. Make sure that there are sufficient data integrity controls at that point to ensure that the data is the type and format you're expecting. The Golden Rule of any database is to always validate data at time of data entry - there can never be an exception to this rule.

There's always a better way. The fun is trying to find it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top