Hello and thank you for taking time out of your day to help me.
I have query which is correctly yielding dozens of records. I have a report which is correctly displaying said records. No problems so far.
In the Report Footer, I placed a textbox with a Control Source of =getMatthewGrace() which is a custom VBA function I made. By chance, I had made a debug.print statement in that function. When I ran the report just once I noticed that the debug.print statement was getting run dozens of times:
It then occured to me that... this isn't a debug.print thing, no, this is evidence that the Report is running my function many many times just to paint the screen once. Not sure why this is. I feel like I need to understand better what's happening to my program so it correctly runs once. Initially I hypothesized that the function is run 1x per row in the query resultset. This is not true. Then I thought it was the number of rows in the resultset + 1. Not true either. Sometimes I'll even pop back and forth between the Report and the Code module only to discover the immediate window is still being populated at machine gun speeds right before my eyes with another few dozen more lines of "Hi, I'm MatthewGrace".
Any ideas how to make it run only once?
Thank you,
Matthew