Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Avoiding Dublicate Field entries in a multi-user applica
Message
 
To
20/02/1998 11:29:23
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00080125
Message ID:
00080129
Views:
29
Jarju,

Using RECNO() to get this number is not a good idea. If nothing else, packing the table will create major problems in your application.

You'd be better off creating a table which holds the next value for any of these numbers. Write a function that:

1. Finds the appropriate record in the table (e.g., work order).
2. Locks the record.
3. Increments the value of the key field
4. Returns the incremented value.

This will insure that the value is unique. You can call the function using the default attribute of the field.


>Am a Visual Foxpro beginner with yet another question.. I need you help on again..
>
>
>I am working on an application that tracks work orders. The work order number field entry is a function of the RECNO() and I want it to be incremented automatically by the program not by the user. I put a default expression for the field in the table structure and also have that field as a Primary index. Well, it seems to be O.K and it's incrementing as I want. BUT this afternoon, I was testing to see what happens when two users opens the database/Table at about the same time to add records. I noticed that both users Work Order No. fields contains the same entries (I suppose 'cos the RECNO() presented to both users are the same). Although they can both have the same values in the wk order field only one can save because of the primary key nature of the field. My problem seems to be how to get different users enter data into the same database with different work order numbers.
>any idea???
>Please help!!! I would be grateful...
Previous
Reply
Map
View

Click here to load this message in the networking platform