scan rest replace tid with padl(str(val(tid)-1),5,"0") endscanI get a uniqueness of primary key error. I have set deleted on. If I do a pack it works, but I can't do that when the users are using it. Any ideas on how to solve the problem without making the primary key not primary? I am working with a treeview active x control and I am using this as a way to identify an item. The treeview source is a table. When the user deletes one, it is deleted from the table. Then I clear the treeview and add all the items all over again. Maybe there is a better way of doing this? It seemed like overkill when I did it, but can't think of any other way as I need to have the primary key matching the key for that item created by foxPro when the treeview is created.