Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Which field caused the error?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Which field caused the error?
Miscellaneous
Thread ID:
00037169
Message ID:
00037169
Views:
77
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?
Next
Reply
Map
View

Click here to load this message in the networking platform