|
Post by DARKNIGHT on Feb 2, 2024 22:44:36 GMT -5
Hey Guys, I am still trying to understand how to create a new record at the end of the R/A file. When I add a new record, as it stands, it just overwrites the last. I would like to know how to do this programmatically. rather then having to try to keep track of what record I left off on. what statement(s) would do this. I would Really Appreciate some help with this Thank you
|
|
|
Post by PaulDZ on Feb 3, 2024 2:10:19 GMT -5
There are two ways to do this as far as I know. The first is to have a control record as the first (#1) record that contains the total number of records. Add 1 to that figure when adding to the file. Read that record as soon as you open the file and you have all the information you need.
The second is to get the length of the file and divide that figure by the record length. That should give you the number of records. Add one to that figure to write to the next record.
Also, if you are interested, you might want to look into ISAM routines. These will keep track of the records, let you sort things using a seperate "key" file, and even use up the space used by former records once deleted. Keep up the good work!
|
|
|
Post by DARKNIGHT on Feb 3, 2024 13:01:05 GMT -5
Thanks Man. I will defiantly try your suggestions, the third one sounds Awesome. I tried writing a sub to delete a record entry, and it all worked except the ID #,which I set to zero.
and the record still came up, when its # was selected. guess I could add a line if IDNum=0 then skip the record on Fetch,and when a new record is written, place it in a position with a Null ID #. along the lines of how data on a Hard Drive is never really removed, but some kind of demarcation is placed at the start of the "Deleted" data,and allows new data to be overwritten in that position. Anyways, Thanks again
|
|