I have a form that shows employees how many vacation and personal days they have for the year.
Then there are 5 subforms that show Vacation Days Used, Vacation Days Scheduled, Denied Vacation Days, Personal Days Used, and Personal Days Scheduled.
If the employee has no Denied Vacation Days, I'd like to hide that subform. The subform is a datasheet view and contains columns for date and number (0.5 for half day or 1 for full day).
Is there a way that when the employee opens this form, if they have no denied vacation they don't see that subform at all?
Thanks!
Never mind! I found the answer:
[FONT="]The following example illustrates how to hide a subform named [/FONT]Orders_Subform[FONT="] if its main form does not contain any records. The code resides in the main form's [/FONT]Current[FONT="] event procedure.[/FONT]
[FONT="]VBA
[/FONT]
[FONT="]
Private Sub Form_Current()
With Me![Orders_Subform].Form
' Check the RecordCount of the Subform.
If .RecordsetClone.RecordCount = 0 Then
' Hide the subform.
.Visible = False
End If
End With
End Sub
[/FONT]
Then there are 5 subforms that show Vacation Days Used, Vacation Days Scheduled, Denied Vacation Days, Personal Days Used, and Personal Days Scheduled.
If the employee has no Denied Vacation Days, I'd like to hide that subform. The subform is a datasheet view and contains columns for date and number (0.5 for half day or 1 for full day).
Is there a way that when the employee opens this form, if they have no denied vacation they don't see that subform at all?
Thanks!
Never mind! I found the answer:
[FONT="]The following example illustrates how to hide a subform named [/FONT]Orders_Subform[FONT="] if its main form does not contain any records. The code resides in the main form's [/FONT]Current[FONT="] event procedure.[/FONT]
[FONT="]VBA
[/FONT]
[FONT="]
Private Sub Form_Current()
With Me![Orders_Subform].Form
' Check the RecordCount of the Subform.
If .RecordsetClone.RecordCount = 0 Then
' Hide the subform.
.Visible = False
End If
End With
End Sub
[/FONT]
Last edited: