I have a form that have several controls on it. I want to disable some of them when the user doesn't have complete authority to them. But when I run the code it says, "Object doesn't support this property or method". I don't know what my fault is. The code is in the open form event.
Private Sub Form_Open(Cancel As Integer)
'get the information send from main form
If Not IsNull(Me.OpenArgs) Then
Me.txtMainOrderID.DefaultValue = """" & Me.OpenArgs & """"
'Control the access of the user to form
Dim UserName As String
UserName = TempVars!tempUserName
If DLookup("frmLithoWorkOrder", "tblUser", "UserLogin='" & UserName & "'") = "Access" Then
ElseIf DLookup("frmLithoWorkOrder", "tblUser", "UserLogin='" & UserName & "'") = "Limited" Then
Me.AllowAdditions = False
Me.AllowDeletions = False
'Disable all controls on form except path file box and lithography notes
Dim ctl As control
For Each ctl In Me.Controls
If ctl.Tag = "litho" Then
ctl.Enabled = True
ctl.Enabled = False
MsgBox "ÔãÇ Èå ÞÓãÊí ÇÒ ÝÑã ÏÓÊÑÓí ÏÇÑíÏ."
MsgBox "ÔãÇ ãÌÇÒ Èå æÑæÏ Èå Çíä ÈÎÔ äãí ÈÇÔíÏ"