For this, you will need a more experieced person than I... and that's not difficult to find... ;)
Hope you find the culprit! (P.S.) I hope someone is not opening the table independent of the program and thus "messing up" the integrity of the primary key assignement process. PabloSr Value, above all, persons, not things. Valora, sobre todo, personas, no cosas. Paz! Peace! Original Message: ----------------- From: James E. Harvey [EMAIL PROTECTED] Date: Tue, 28 Nov 2006 15:03:46 -0500 To: [EMAIL PROTECTED] Subject: RE: Auto Inc as PK index I set the "Next Value" number manually several months ago when the table was first set up with the auto-Inc field, and many new records have been added successfully since then. Today was the first occurrence of this error and I could see the number for the "Next Value" was re-set to a very low number, "4". I was wondering if this is a common occurrence, "bug", or should I be looking for something specific that could cause this behavior. James E. Harvey Corresponding Officer/M.I.S. Hanover Shoe Farms, Inc. www.hanoverpa.com [EMAIL PROTECTED] 717-637-8931 fax: 717-637-6766 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, November 28, 2006 2:17 PM To: profox@leafe.com Subject: RE: Auto Inc as PK index >From my position of professional newbie, I'll take a stab at this. I would backup the table, and, indeed the whole database. Then, open the affected table in exclusive mode and examine the "AutoInc" settings you will realize that you can set the "Next Value" number manually. This, of course would not make it random, but would resolve the immediate issue. You should determine that there are no "blank" records added (that is, records without an assigned value in the primary key field/index). Save the table and you should be good to go. The above advise applies to VFP 9 SP1, as that is the only copy I have running on my machine. Regarding the question on the "random" generation of primary keys, I have identiffied two major and different ways to handle it, one is through a stored procedure inside the database that hosts the tables, and the other is via a separate class that assigns the primary key value. In both instances you may use a reference table to hold the "Next Value" for each separate table where you wish to implement the "unique/primary" key feature. The actual assignment of the value is called by a default value procedure called from the primary key in the table properties itself. An example of the use of a class for the assignment of this unique value may be found in the Hentzenwerke book "The Fundamentals....". This is the model I am trying to adopt in my tables, but am not there yet. And surely there are other places where you may find examples of either approach. I hope this helps. PabloSr Value, above all, persons, not things. Valora, sobre todo, personas, no cosas. Paz! Peace! Original Message: ----------------- From: James E. Harvey [EMAIL PROTECTED] Date: Tue, 28 Nov 2006 13:48:00 -0500 To: [EMAIL PROTECTED] Subject: Auto Inc as PK index I am using an auto inc field as the pk index tag. Today the user could not add a record due to pk uniqueness violated? I opened the table and found the "Next Value" set to "4"? There are over 275 records already in the table. I opened on older backup of the table and the "Next Value" was okay. Does anyone know how the "Next Value" field could be reset to an apparently random number? James E. Harvey Corresponding Officer/M.I.S. Hanover Shoe Farms, Inc. www.hanoverpa.com [EMAIL PROTECTED] 717-637-8931 fax: 717-637-6766 -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ . _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** 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.