Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Valid & Error events
Message
 
To
05/06/1998 17:57:15
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00105397
Message ID:
00105672
Views:
33
>How can I get this to work, the goal is to seek the user's input in the database, from the begining in order to force him to change it if already exists, but still have the index as Primary
Rafael,

First, most of us use surrogate primary keys that are assigned from a call in the default value field of the dbc so we don't encounter this problem.

We still do have those customer number's that need to be unique but are not the PK for the table. My approach is to keep a view in the dbc named custno which is simply all the custno's in the customer table. I do may seek in there and if I find a match I give the messagebox and then RETURN 0 (not .f.). A return of .f. will cause the error message to be displayed while return 0 means its ok but stay in the same control.

With this approach it makes no difference whether the index is primary candidate o0r not because the lookup is done in the view and not the table.

You haven't hit this yet but if you use row buffereing in that table the seek() is going to try and do an update to the table on you.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform