Solved Get value of a textbox on the parent form from subform (1 Viewer)

gringope24

Member
Local time
Today, 11:01
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?
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 06:01
Joined
May 21, 2018
Messages
8,463
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.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:01
Joined
Feb 19, 2002
Messages
42,970
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

Top Bottom