In my MS Access application, I am using a form which contains only two controls - a textbox and a command button. This form is named as HEADER FORM
.
HEADER FORM
is used as a subform in header section of various other forms.
What I want to do is that whenever a particular form loads, I want to fill details in the textbox of the HEADER FORM
(that will be name of the person who has logged in. The same would be clear from the picture below).
I am trying to call a global subroutine named updateHeader
in form load event of all the forms.
Public Sub updateHeader()
Me![HEADER FORM].Form.txtHeaderName.Value = strPerson
End Sub
Following is the picture showing HEADER FORM
in Design View and the same being used as a subform in a login form.
I tried various other options but am not able to come out with the correct way to reference the form. Am I doing something wrong fundamentally?
The error that I am seeing is invalid use of Me
keyword.
Also, my updateHeader
subroutine is a global subroutin which is called from Form_Load event of all the forms.