docmd.openform triggering wrong form

SantoR

Registered User.
Local time
Today, 18:21
Joined
Apr 20, 2015
Messages
38
Hi i have login screen from where i am moving to my mainform using DoCmd.OpenForm "MainForm", acNormal, , , , , [Forms]![Fm_LoginScreen]![txt_UserId].Value

but instead of opening form_load() event of mainform , this line is opening another forms form_load() event and then mainform form_load() event

can any one tell whats wrong here
 
It the other form a subform in the main form?
 
thanks JHB problem solved !! u got it right ..actually i have a subform in the mainform. the recordsource of which changes dynamically.
so the last call form inside the subform was permissionFm which was getting called before the mainform.


thanks JHB again

can you tell me how to avoid the this problem in future
one is to code recorsource = "" every time logging out

any other...
 
can you tell me how to avoid the this problem in future
one is to code recorsource = "" every time logging out

Don't use the OnLoad Event of the subform unless you want it to always run.

Move its code to another procedure which is only called when required. Make that procedure public so it can be called from outside the form.

Then you can code the parent form to conditionally trigger it when it is loading. The conditional trigger can be passed using an OpenArgs parameter in the OpenForm Method of the main form.

There are so many different ways to do it.
 

Users who are viewing this thread

Back
Top Bottom