I don't use macros so perhaps the execution is different. In VBA code, the lines after opening a form in dialog mode won't run until the form is either closed or hidden.
If you can't get it to work one way, try another. Like Paul, I don't use macros due to their limitations and difficulty in documenting and debugging, so was just a suggestion.
here is a link from 2007, which offers the original advice (and an old one of Pauls!)
I'm sure there are but we are all volunteers, the majority of regular responders being professional developers who use VBA.
Take a look at a) the relatively few threads there are on macros v vba (3510 v 43277 at current count) and b) see if you can find any examples in the code repository or sample databases which use macros to form an opinion.
But a good question to put on the watercooler to see what the response is