make form visible/invisible depending on whether it has records

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

Guest

I have a form with a subform. If there are no records in the subform, the
subform is invisible.

If a record needs to be added to the subform, I have a command button that
opens a form that allows records to be added to the subform. When I close the
form, I want the subform to appear since it now has a record in it. But the
only way I can get it to reappear is to click out of the main form record &
then re-enter the main form record.

I used the Dev Ashish idea of
With Me![SubformName].Form
.Visible = (.RecordsetClone.RecordCount > 0)
End With
to determine whether or not the subform should be visible.
 
Did you try to requery the subform?


|I have a form with a subform. If there are no records in the subform, the
| subform is invisible.
|
| If a record needs to be added to the subform, I have a command button that
| opens a form that allows records to be added to the subform. When I close
the
| form, I want the subform to appear since it now has a record in it. But
the
| only way I can get it to reappear is to click out of the main form record
&
| then re-enter the main form record.
|
| I used the Dev Ashish idea of
| With Me![SubformName].Form
| .Visible = (.RecordsetClone.RecordCount > 0)
| End With
| to determine whether or not the subform should be visible.
 
Back
Top