>As a newbie to FoxPro (Clipper convert) and Windows programming, I have problems with VFP primary indexes on two fronts:
>
>1. There are occasions when the uniqueness of a primary code is violated. I get an error message to that effect with no recovery possible (while running the program). There is no recourse but to re-boot. How can I trap this error and recover from it a little more gracefully?
>
>2. A user marks a record for deletion, but does not pack. It's deleted primary code field triggers #1, above, if re-used. I don't want to pack on every deletion. What to do?????
>
>Thanks in advance for any help.
Welcome to VFP! I was also a Clipper coder in the dark days of long ago. I created a table which contained summary information about tables and their relationships. For the purpose of performing duplicate checks and insuring referential integrity. Before I commit a record, I check a couple of things: 1) Duplicate Primary Key, 2) Does Parent record exist, 3) Is Parent record marked for delete and some other stuff not to bore U. My duplicate routine is simple. Just a seek against the table. I believe it is an SQL routine and I check _Tally = 0 before writing the record.
Well, this is just an approach I used in the past. With the DBC some of the routines/properties make my psuedo DBC table obsolete. U can loop thru a index file and check if it is the primary. Then extract that key. This may be a little more cleaner for just a duplicate check. I needed the psuedo DBC detail table for complex relationship checking. Just some thoughts. htwh. Steve
Steve Medvid
Systems Analyst
Environmental Resource Management