BigBlueScreen
Technical User
Hi,
I'm trying to disable a project if = "closed", but its greying everything & nothing is disabled.
Heres the code I'm using :
Private Sub Form_Load()
Me.NavigationButtons = False
Dim dbs As Database
Dim rst As Recordset
Dim strUserID As String
Set dbs = CurrentDb()
'checking UserId exists Employee table
Dim strCritEmp As String
strUserID = Form_Login.UserID.Value
'MsgBox ("Welcome subform" & strUserID)
strUserID = "'" + strUserID + "'"
strCritEmp = "[EmployeeID]=" + strUserID
Set rst = dbs.OpenRecordset("Employee", dbOpenDynaset)
rst.FindFirst (strCritEmp)
If rst.NoMatch Then
Form_ProjectSubform.ProjectNo.Enabled = False
Form_ProjectSubform.ProjectName.Enabled = False
Form_ProjectSubform.DeleteQEmployee.Enabled = False
Form_ProjectSubform.ProjectAddNew.Enabled = False
Form_ProjectSubform.ProjectDetail.Enabled = False
Else
Form_ProjectSubform.ProjectNo.Enabled = True
Form_ProjectSubform.ProjectName.Enabled = True
Form_ProjectSubform.DeleteQEmployee.Enabled = True
Form_ProjectSubform.ProjectAddNew.Enabled = True
Form_ProjectSubform.ProjectDetail.Enabled = True
End If
If Form_ProjectSubform.ProjectStatus.Value = "closed" Then
Form_ProjectSubform.ProjectName.Enabled = False
Form_ProjectSubform.ProjectNo.Enabled = False
Form_ProjectSubform.ProjectStatus.Enabled = False
Else
If Form_ProjectSubform.ProjectStatus.Value = "open" Or "Pending" Then
Form_ProjectSubform.ProjectName.Enabled = True
Form_ProjectSubform.ProjectNo.Enabled = True
Form_ProjectSubform.ProjectStatus.Enabled = True
End If
End If
End Sub
Any help would be GREATLY appreciated..
Thanks,
Jd
I'm trying to disable a project if = "closed", but its greying everything & nothing is disabled.
Heres the code I'm using :
Private Sub Form_Load()
Me.NavigationButtons = False
Dim dbs As Database
Dim rst As Recordset
Dim strUserID As String
Set dbs = CurrentDb()
'checking UserId exists Employee table
Dim strCritEmp As String
strUserID = Form_Login.UserID.Value
'MsgBox ("Welcome subform" & strUserID)
strUserID = "'" + strUserID + "'"
strCritEmp = "[EmployeeID]=" + strUserID
Set rst = dbs.OpenRecordset("Employee", dbOpenDynaset)
rst.FindFirst (strCritEmp)
If rst.NoMatch Then
Form_ProjectSubform.ProjectNo.Enabled = False
Form_ProjectSubform.ProjectName.Enabled = False
Form_ProjectSubform.DeleteQEmployee.Enabled = False
Form_ProjectSubform.ProjectAddNew.Enabled = False
Form_ProjectSubform.ProjectDetail.Enabled = False
Else
Form_ProjectSubform.ProjectNo.Enabled = True
Form_ProjectSubform.ProjectName.Enabled = True
Form_ProjectSubform.DeleteQEmployee.Enabled = True
Form_ProjectSubform.ProjectAddNew.Enabled = True
Form_ProjectSubform.ProjectDetail.Enabled = True
End If
If Form_ProjectSubform.ProjectStatus.Value = "closed" Then
Form_ProjectSubform.ProjectName.Enabled = False
Form_ProjectSubform.ProjectNo.Enabled = False
Form_ProjectSubform.ProjectStatus.Enabled = False
Else
If Form_ProjectSubform.ProjectStatus.Value = "open" Or "Pending" Then
Form_ProjectSubform.ProjectName.Enabled = True
Form_ProjectSubform.ProjectNo.Enabled = True
Form_ProjectSubform.ProjectStatus.Enabled = True
End If
End If
End Sub
Any help would be GREATLY appreciated..
Thanks,
Jd