Solved Get value of a textbox on the parent form from subform

gringope24

Member
Local time
Today, 22:31
Joined
Apr 1, 2020
Messages
51
Hello Folks,
I have a parent form frmStatement. It has subform sfrmGeneral, which is placed in ControlTab.

In the header of frmStatement there is txtbox named txtDisplayMode. It receives values 0 or 1 from OpenArgs. This control is unbound.

For sfrmGeneral, on Form_Load event I cannot read the value of txtDisplayMode, because i am receiving error 94: Invalid use of Null.

I am testing it with simply macro, but receives error as mentioned above.
Code:
MsgBox Me.Parent!txtDisplayMode

Does anyone have idea how to solve this?
 
The problem is that forms load from the inside out so the subform loads before the main and thus txtDisplaymode is not loaded yet. These are always tough problems without having a chance to play with it, because it is a timing issue. You can try adding doevents to the subform on load to see if that will allow the other cached events to finish. If you can call it from the main instead, that may be an alternative.
 
Add an error handler and ignore that particular error. You might also want to move the code to the main form's Current event.
 

Users who are viewing this thread

Back
Top Bottom