Changing Startup form before opening application
Hi,
I am working on one requirement where application has two forms. Now there are two modes to open this application, one when user directly open it by selecting accde file and other when another application opens this file through VBA code.
The code written to open app is:
Dim appAccess As New Access.Application
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "ABC.accde"
appAccess.TempVars.Add "strAppName", "XYZ"
appAccess.Visible = True
DoEvents
Basically I want to track if app is opened from user interaction or from other app.
Since there is user interaction I have to set Startup form. But that has to be dynamic.
I thought of creating one blank form which will see if TempVar is available or not in Form_Load and decide on which form to open.
But I don't get TempVar inside Form_Load becuase this event occures when calling OpenCurrentDatabase method.
Is there any way we can change file startup form property before opening it?
Or is there any event available in for which is delayed and occures after setting TempVar and also occurs even if TempVars are not set?
I have tried another solution with timer which starts in form load for 2 seconds, and assuming that within 2 sec TempVars are set and then doing operation in Form_Timer method. This works but we are reluctant to go with this approach.
Your help is greatly appreciated.
Thanks & Regards,
Shailesh
|