Accessing Sub Form Name when loading

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a common routine which is always called on the form open event. This
function is passed a parameter of (me.name).
The function itself interrogated the Forms collection and sets various
controls as desired.

My problem is where I have a sub form within a main form, when the main form
is loaded, it invokes the open of the sub form (which in turn activates the
open event), the value being passed over to the function is the name of the
sub form but this form is not in the forms collection (only the main form
is), which causes the finction to fail

Is there any way round this?

Many Thanks
Chris
 
Chris said:
Hi

I have a common routine which is always called on the form open event. This
function is passed a parameter of (me.name).
The function itself interrogated the Forms collection and sets various
controls as desired.

My problem is where I have a sub form within a main form, when the main form
is loaded, it invokes the open of the sub form (which in turn activates the
open event), the value being passed over to the function is the name of the
sub form but this form is not in the forms collection (only the main form
is), which causes the finction to fail

Is there any way round this?

Not really. As far as Access is concerned, the subform isn't open: only the
form itself is.
 
Chris said:
I have a common routine which is always called on the form open event. This
function is passed a parameter of (me.name).
The function itself interrogated the Forms collection and sets various
controls as desired.

My problem is where I have a sub form within a main form, when the main form
is loaded, it invokes the open of the sub form (which in turn activates the
open event), the value being passed over to the function is the name of the
sub form but this form is not in the forms collection (only the main form
is), which causes the finction to fail

Is there any way round this?


I suggest that the common routine use the form object, Me,
(instead of the form name) as its argument.
 
Back
Top