Information générale
Titre:
Which field caused the error?
I am glad to see that VFP 5 fixed the problem where the Error event now handles DBC Field Rule violations. Unfortunately, now there is another problem.
I created a database with one table that has one field. This field is numeric and I have for the Field Rule: num < 10 and the Error Text: "Number be less than 10." I create a form with one controls, a TextBox with the controlSource for this field. I add a record to the table with a valid value.
In the TextBox's Valid Event, I have the following:
REPLACE num WITH 13 && Force an error
In the TextBox's Error Event, I have the following:
= AERROR(laError)
DISPLAY MEMORY LIKE laError TO FILE C:\Error.txt
When I run this in VFP 3.0, I get the following in C:\Error.txt:
LAERROR Local A error
( 1, 1) N 1582 ( 1582.00000000)
( 1, 2) C "Field NUM validation rule is violated."
( 1, 3) C "NUM"
( 1, 4) N 1 ( 1.00000000)
( 1, 5) C .NULL.
( 1, 6) C .NULL.
( 1, 7) C .NULL.
When I run this in VFP 5.0, I get the following in C:\Error.txt:
LAERROR Local A error
( 1, 1) N 1582 ( 1582.00000000)
( 1, 2) C "Number must be less than 10."
( 1, 3) C "Number must be less than 10."
( 1, 4) N 1 ( 1.00000000)
( 1, 5) N 1 ( 1.00000000)
( 1, 6) C .NULL.
( 1, 7) C .NULL.
In VFP 3, I could use laError [3] to determine the name of the field causing the error. In VFP 5.0, there is no way that I can see to determine the field. Any comments?
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement