I have been searching for a few days for a simple answer to this question:
Does the VBA code behind/in a report run when the report is open in Preview mode AND hidden?
I have inherited a P-O-S (Not Point-Of-Sale) Access 2003 database (Written mostly in German) that has a report with a very long and complicated VBA module attached to it. I need the code to execute when the report is run in Preview mode but it does not.
The report is called from a form with the following line:
DoCmd.OpenReport "Fertigungszettel",acPreview, , , acHidden
I then close the form with the following line
DoCmd.Close acReport, "Fertigungszettel", acSaveNo
The problem is that the code in/behind/attached to the report does not seem to run. I thought maybe I needed to delay the closing so that Access had time to run code so I added the following to the report vba
Private Declare Sub Sleep Lib "kernel32" (ByVal dwmilliseconds As Long)
Public SleepPls(ByVal ISecs As Long)
Sleep(ISecs * 1000)
End Sub
And I added the line to call it like this:
SleepPls(10)
But it made no difference.
Can anyone either explain this to me or point me somewhere that will explain this in a simple way. I ask for a simple way because I will have to explain this to upper management who are not Dev's. (Not even close).
Thanks in advance.