I am new to VFP and was handed an emergency project that was being developed in it, and want to say that this forum has been immensely helpful to me thus far - thanks to all of you. I'm stuck using v3.0 and it can be hard to find information.
I am working on an inventory application which involves several tables - 3 of which are Box, Owner, and Item. Owner and Item are both children of Box, and are linked by a key of FID, SFX, YR, and BOX #. BOX # is sequential and corresponds to the number of boxes for a particular FID. The records on the child tables have sequence numbers as part of their keys, also, to keep them unique. I have filters set on the child tables in the forms' data enviornments to display the appropriate records on the screens. For the deletes, I am using a DELETE command, followed by PACK. When deleting a child record, I renumber the remaining sequence numbers to avoid gaps - if I delete Item #3 out of 5, I replace the sequence numbers with 1 thru 4. All is well and good for a delete on a child table. However I am having trouble when I perform a delete on the Box. The DELETE and PACK work fine - the Box record is deleted as well as the associated child records on OWNER and ITEM. But to do this, I had to put in a USE statement on the child tables - SELECT or USE alone both give me buffering errors. (This is not a mult-user enviornment and the table access is set as EXCLUSIVE in the data enviornment of the form). Apparently this destroys the cursors from my data enviornment as I cannot access the tables by their aliases after that point, whether or not I close the tables after the PACK command. I can USE the tables again but my filtering is gone - I end up accessing incorrect records. I need to access the correct records to update the remaining box and sequence numbers after the delete, as well as to restore the form after the delete. I tried refreshing the form and saving the aliases, neither of which worked, so I've been working on using SQL to access the reords but thought maybe there is a better way - does anyone know of a way to restore / reset the data enviornment for the form after the cursors have been lost? Or is there some way to prevent this loss in the first place?
lcmg62
I am working on an inventory application which involves several tables - 3 of which are Box, Owner, and Item. Owner and Item are both children of Box, and are linked by a key of FID, SFX, YR, and BOX #. BOX # is sequential and corresponds to the number of boxes for a particular FID. The records on the child tables have sequence numbers as part of their keys, also, to keep them unique. I have filters set on the child tables in the forms' data enviornments to display the appropriate records on the screens. For the deletes, I am using a DELETE command, followed by PACK. When deleting a child record, I renumber the remaining sequence numbers to avoid gaps - if I delete Item #3 out of 5, I replace the sequence numbers with 1 thru 4. All is well and good for a delete on a child table. However I am having trouble when I perform a delete on the Box. The DELETE and PACK work fine - the Box record is deleted as well as the associated child records on OWNER and ITEM. But to do this, I had to put in a USE statement on the child tables - SELECT or USE alone both give me buffering errors. (This is not a mult-user enviornment and the table access is set as EXCLUSIVE in the data enviornment of the form). Apparently this destroys the cursors from my data enviornment as I cannot access the tables by their aliases after that point, whether or not I close the tables after the PACK command. I can USE the tables again but my filtering is gone - I end up accessing incorrect records. I need to access the correct records to update the remaining box and sequence numbers after the delete, as well as to restore the form after the delete. I tried refreshing the form and saving the aliases, neither of which worked, so I've been working on using SQL to access the reords but thought maybe there is a better way - does anyone know of a way to restore / reset the data enviornment for the form after the cursors have been lost? Or is there some way to prevent this loss in the first place?
lcmg62