I have a Email macro which I converted to VB in Access 2016. When you click the Email button for each record the macro attaches the detail spreadsheet and email the client. I have to click this email button a total of 550 times or more for each client records...My form has two parts to it...I click on each Payee record to pull the details form up and then I click on the Email Detail button to email the client with their attached detail pay spreadsheet. I would like the Email button to loop through each record and perform the task without having to manually go through each record until EOF but I'm unsure how and where to place this in my macro or code...Any help with this would be greatly appreciated...Thanks in advance...See the sample files below... Sample_Code.txt Email_Macro.png
The code below just prints out 20 when it's done. Your code would go in the while section and assumes you know the number of client records (550+). If you have the clients in a table it should be easy enough to determine the number.
If you need to count records of the client maybe try DCount to return the number of records and let that be your end(i.e., replace the 20 in the sample code).
Open in new window