Ensuring all processes are complete before continuing
Posted on 2016-10-21
I am writing a function via MS-Access VBA that generates several files and stores them in a folder (PDF, XLSX etc). It then creates an email and attaches all of the files within the specified folder (I am using EASendMail to do this). On my PC it works just fine, but I'm a little concerned that on a slower PC/network, Access (or the PC itself) may still be creating the files (XLS, PDF etc.) when the command to attach all of the files is issued (jumping ahead of itself).
Ideally, I'd like someone to come back to me and say that Access will not start work on the email/attach function until the previous processes have all finished, or before issuing the "oSmtp.AddAttachments" command, you should do x to ensure everything has been done.
I know I could check that the files in the folder exist before attaching (but if I don't have to do this, I'd rather not).