Change properties for control on another form (subform)

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.
 
A

Allen Browne

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.
 
J

Joe M.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top