Hiding subform on open

Design by Sue

Registered User.
Local time
Today, 09:58
Joined
Jul 16, 2010
Messages
816
I need to hide my subform on load or open of the main form but am experiencing some weird results. I have tried putting Me.SubForm.Form.Visible = False in both the on open and the on load of the main form and it works only if the tables on which the subform have records in them. If the tables for the subforms are empty I get an error 2467 telling me that "The expression you entered refers to an object that is closed or doesn't exist." I find this strange because from all I can find the subform loads first.

How can I hide the subform when the main form opens no matter what records exist or don't??

Sue
 
You could try setting the subform to not have a control source at first, and only insert one once the user does something. That should allow you to default the subform to invisible.
 
Thanks - actually it was Record Source - strange thing is I did have this correct but somehow the record source became part of the properties list and that was what was causing the problem. I must have been working in code and close the form before while the record source was entered and then it just stayed there (I have had this happen before) Thanks so much for pointing me in the correct directly.
 
this

Me.SubForm.Form.Visible = False

should be this

Me.SubForm.Visible = False
 
I have it as shown and it is working - what is the difference between the two?
Sue
 
actually nothing so far as I can see! I've just never done it that way.:D
 

Users who are viewing this thread

Back
Top Bottom