Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Field validation and duplicate entries
Message
From
27/01/2006 18:26:21
 
 
To
27/01/2006 10:03:36
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01090901
Message ID:
01091112
Views:
14
Is it a requirement that the user generate the customer number? I'm pretty sure VFP 6 does not have an AutoIncrement field so that's not an option. When you create the field, can you find the current highest value and then increment by one? Even better is to keep a table of Primary Keys which you then use to generate the next customer number.

Failing that, in the Valid event for the Customer Number field you could do something like
IF INDEXSEEK(this.value,'customer')
   =MESSAGEBOX("Duplicate Number")
   RETURN 0
ELSE
   RETURN .T.
ENDIF
>Hi everyone,
>
>I apologize for asking what surely must be a very rookie-level question, but I've got something here that's making me nuts. The light bulb over my head must be burned out, so hopefully someone will light it up for me.
>
>I've got two forms. One for customers and one for parts. In the Customers table, I've got a primary index set on cust_no so a duplicate cust_no can't be entered. When the user is entering data into the form, if they use a duplicate cust_no, it still allows them to enter the rest of the data in the form and doesn't reject it until they click the "Save" button, then try to move to a new record, at which time it says "Uniqueness of index CUST_NO is violated." I'd like for it to check that cust_no at the time it's entered into the cust_no field and prevent them from entering any more data until they put in an unused cust_no.
>
>Similarly, in the Parts table, there are two fields that make each entry unique: part_no and revision. I'd like the user to be able to enter both of those fields before checking to see if there's already another part_no/revision combination in the table.
>
>Can someone point me in the right direction, please?
>
>Thanks!
>
>John
Previous
Reply
Map
View

Click here to load this message in the networking platform