Change properties for control on another form (subform)

  • Thread starter Thread starter Joe M.
  • Start date Start date
J

Joe M.

I have a cmd button on the main form which when clicked I would like to
change the properties (visible property) on the subform. I know this must be
simple but so far no luck. Can anyone help please? Also is there a way to
close the subform from the cmd button on the main form?
I tried DoCmd.Close acForm, "Name of SubForm" but form stays open.

Thanks in advance,
Joe M.
 
The main form contains a subform *control*, and the SourceObject of that
control indicates the name of the form it contains. For example, the subform
control may be called Sub1, and it may contain a form named Form2.

If so you would hide it from the main form (provided it does not have focus)
with:
Me.Sub1.Visible = False
Or you could remove Form2 from it by clearing its SourceObject:
Me.Sub1.SourceObject = vbNullString

Note that if you set the SourceObject again, Access will have a guess at
what you want for its LinkMasterFields and LinkChildFields properties, but
this may not be what you intend.
 
Allen,

Thanks for the info. Actually I did not state my question completely. What I
would like to do is change the properties of a control on the subform from a
cmd button on the main form.

Thanks in advance,
Joe M.
 
Back
Top