Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

code help ---disable control

Status
Not open for further replies.

BigBlueScreen

Technical User
Jul 23, 2004
31
US
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top