strange subform issue

Zaeed

Registered Annoyance
Local time
Tomorrow, 02:40
Joined
Dec 12, 2007
Messages
383
This is more of an annoyance than anything.

My db starts with a main form (MainMenu) that contains a subform where everything happens. MainMenu is always open, with all actions occuring within the subform.

The subform starts off with the form frm_Login as its source. Once login has been performed, frm_Menu is loaded, and from here any number of other forms are loaded.

My issue is that sometimes the subform of MainMenu changes to frm_Change by itself, which causes an error when loading MainMenu.

I have a hunch that the cause is due to the db faulting during testing on frm_Change, and its saving the subform source as frm_Change.

Is it possible to force the source of the subform to change to frm_Login when MainMenu is loaded? I have tried inserting code into the forms Load procedure but this still gives an error somehow. The only way i've been able to fix it is to manually edit the form and change the subforms source to the correct form.
 
Not 100% sure on this and not tested, but try the "On open" event instead
 
You aren't by chance using something like

DoCmd.Close acForm, "FormNameHere", acSaveYes

anywhere are you? The acSaveYes (as opposed to acSaveNo) means to save design changes (not records).
 
nope, no acSaveYes statements anywhere.

The open event doesnt work either Mailman. When I open the form, it gives me an error, and then continues and works correctly. But that happens everytime I open it.

Does the forms Close event run even when the code faults and the window is closed manually? Cause I could put the code in there with the acSaveYes to set the subform to the correct source couldn't I?
 

Users who are viewing this thread

Back
Top Bottom