visible subform

  • Thread starter Thread starter J.J.
  • Start date Start date
J

J.J.

hi
i want that my subform is visible only if number_id_field on it is not null.
is it possible and how can i do it?
many thanks
JJ
 
J.J. said:
i want that my subform is visible only if number_id_field on it is not null.
is it possible and how can i do it?


Not sure what you mean, but try this:

Me.subformcontrol.Visible = Not IsNull(Me.number_id)
 
It didn't work,
here what i want: i have a form and subform. they both have number_id field
and then i get data from another table in the subform reffering to number_id
on main form. now i want that the subform is not visible when it's number_id
field is null. where should i put the code?
on subform or main form?
thanks one more time
JJ
 
J.J. said:
here what i want: i have a form and subform. they both have number_id field
and then i get data from another table in the subform reffering to number_id
on main form. now i want that the subform is not visible when it's number_id
field is null. where should i put the code?
on subform or main form?


Sorry, I still don't understand. If the subform control's
Link Master/Child properties are both set to the number_id
field, then the only way you can get a Null value in the
subform's number_id field is if there are no records in the
subform. Further more, if there are no records in the
subform, then the only thing it will display is the area to
allow a new record to be entered. Making the subform
invisible in ths situation will make it impossible to create
new records. If that's what you want, then just set the
subform's AllowAdditions property to No and it will
automatically disappear when there's no data for it to
display.
 
hi
it's already set to no but it's still visible. i put the subform in main
form footer. and the relationship type is indeterminate, i didn't set
enforce referential integrity. one more question: is there a way to
autoshrink the columns on subform when i open each record on main form?
thanks again
JJ
 
J.J. said:
it's already set to no but it's still visible. i put the subform in main
form footer. and the relationship type is indeterminate, i didn't set
enforce referential integrity. one more question: is there a way to
autoshrink the columns on subform when i open each record on main form?


Ok, the border is still there. If you want the whole thing
to be invisible (like you originally said) then use a line
of code like this in the main form's Current event:

subform.Visible = subform.Form.RecordsetClone.RecordCount
--
Marsh
MVP [MS Access]


 
Back
Top