Cindy Winegarden
Hi Ahsan,
To go a little further with what everyone else said, most Fox developers use SET DELETED ON in their applications so as to ignore deleted rows. SET DELETED is scoped to the data session so developers using private data sessions in their forms usually use a base form class of their own design and subclass all their other forms from that. In the LOAD() of the base class form they include SET DELETED ON.
Some developers PACK their tables as part of an off-hours maintenance routine since they can have exclusive use of the tables.
Many times when people ask a question like your #1 it is because they want to re-use a primary key and the Fox data engine won't let them. In my tables I use a Primary key value that is generated by a stored procedure. This value has nothing to do with the data and is used only for joining tables. When I have a Candidate key such as an invoice number or US Social Security number the Fox data engine stops the users from entering the same value twice. My usual advice when posters ask this question when they want to re-use a Primary Key is to think carefully about they want to re-use a Primary Key value since it isn't a good idea.
For your question #2, the simplest thing to do is to use SET DELETED ON either at the data session level or immediately before the SELECT statement. In my apps I use only the default data session so I issue SET DELETED ON at the beginning of my Main program and everything is fine after that.