I have a very unusual situation and wonder if someone might be able to give me some guidance. I am the volunteer "IT" guy for our local food bank and many years ago I wrote an Access program to allow them to track their clientele. The data is primarily used to support grant requests obtaining data for the number of people who use the food bank and how often they visit. I placed a field in the main table called "count" and each time a client applies for assistance the counter increases by 1. It is reset on January 1 each new year. If a client comes in in January, the counter field will have a 1 in it. If the client comes in again in February, the counter will have a 2 in it etc. Each client has a client Id number (unique to the client) and a record number (unique to the visit). For example, the first time the client comes in they are given a ClientId number say, 1000 and the RecordId number for that visit is also 1000. The second time the client comes in his ClientId number will be still be 1000 but the recordId number will be the next number 0f the series of numbers that records every clients visit and may be, for example 1356. The third time the client comes in the ClientId number will still be 1000 but the recordId number will be the next number of the series of numbers that records every clients visit, i.e. 1637. The counter field will have a 1 for the first visit, a 2 for the second visit, and a 3 for the third visit.
Unfortunately, I did some revisions on the program last year and all the count number fields were set to 1 so I now have no way of telling how many visits each client made. My thoughts are these: since each ClientId number is unique and each record number is linked to a specific client is there a way to write a query or visual basic code that could place the correct count for subsequent visits by a single client and have it loop back to do the same to the next client. For example, write a select query for a specific ClientId then if the count has a 1 in it for the first record, the count field for a second visit by the same client would become 2, for the third visit 3, etc. until there are no more records in the database for that client. Then, the query would reset to the next ClientId number and loop back on the process and set the count field to 2, for the second visit, 3 for the 3rd visit, etc.
I know this is fairly complicated, but I thought someone might enjoy solving the programmatic puzzle.
The name of the table is tblmain, the name of the fields are clientid, recordid, and count. There is also a date field which will allow me to remove all records that are not in the calendar year I am focusing on which, in this case is 2024.