On 7/11/2017 3:32 AM, Paul Newton wrote:
Hi all

Have been looking at all the responses to this and thought it might be useful to point 
out another potential problem with values in numeric fields with a decimal part.  If you 
have a field MyField N(6,2) in theory it should have a maximum value of 999.99.  However 
VFP will happily store values like 9999.9, up to 999999.  IMO VFP should not allow this 
and it is a problem when accessing the data using ODBC or OLEDB.  The solution for us was 
to disallow values greater than VAL("999.99").  The character part being 
constructed knowing the field definition, in this case N(6,2)

A side note: you can use database triggers to restrict values stored in databases.

And for VFP "screens" you can use the spinner control to get good control of value ranges. Actually, in VFP, you could create a subclass control that would examine the underlying data structure type and limit things in its own valid event, blah blah blah (and it could be pretty generic and handle all kinds of rules with numbers).

But yes, since VFP stores its "N" format as a character representation of a number instead of a "true" number, these weird things happen.

-Charlie


_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/be6b5dcc-f057-ebfa-da3d-42d31bf0c...@gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to