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.
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.
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.
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!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.