D
Dave Elliott
I tried this code in a module and called it on the onclick event of a
command button on my form to open the Main form with my sub-from on it.
If the control NameB IsNull , then I want to sub-from to be invisible, else
visible.
It is not working. meaning it is not hiding the sub-form Time_Hours using
the criteria provided
Function EnableCtl() ' This is my Module
On Error GoTo EnableCtl_Error
If IsNull(Forms!TimeCards!TimeID) Then
Forms!TimeCards!Time_Hours.Visible = False
Else:
Forms!TimeCards!Time_Hours.Visible = True
End If
EnableCtl_Exit:
Exit Function
EnableCtl_Error:
MsgBox "Unexpected error"
Resume EnableCtl_Exit
End Function
Private Sub Command72_Click() ' This code is on a command button on the
MASTER form which if clicked opens the main form w/ sub-form
On Error GoTo Err_Command72_Click
Dte1 = Forms!frmAutoPayrollReport!StartDate
Dte2 = Forms!frmAutoPayrollReport!EndDat
Call EnableCtl
DoCmd.OpenForm "TimeCards"
Exit_Command72_Click:
Exit Sub
Err_Command72_Click:
MsgBox err.Description
Resume Exit_Command72_Click
End Sub
command button on my form to open the Main form with my sub-from on it.
If the control NameB IsNull , then I want to sub-from to be invisible, else
visible.
It is not working. meaning it is not hiding the sub-form Time_Hours using
the criteria provided
Function EnableCtl() ' This is my Module
On Error GoTo EnableCtl_Error
If IsNull(Forms!TimeCards!TimeID) Then
Forms!TimeCards!Time_Hours.Visible = False
Else:
Forms!TimeCards!Time_Hours.Visible = True
End If
EnableCtl_Exit:
Exit Function
EnableCtl_Error:
MsgBox "Unexpected error"
Resume EnableCtl_Exit
End Function
Private Sub Command72_Click() ' This code is on a command button on the
MASTER form which if clicked opens the main form w/ sub-form
On Error GoTo Err_Command72_Click
Dte1 = Forms!frmAutoPayrollReport!StartDate
Dte2 = Forms!frmAutoPayrollReport!EndDat
Call EnableCtl
DoCmd.OpenForm "TimeCards"
Exit_Command72_Click:
Exit Sub
Err_Command72_Click:
MsgBox err.Description
Resume Exit_Command72_Click
End Sub