Private Sub Form_Open(Cancel As Integer)
On Error GoTo Form_Open_Error
' If CheckAccessID = False Then Cancel = True
Call LockEm ' <---------------
DoCmd.Maximize
End Sub
' ******************
Private Sub LockEm()
Dim ctr As Control
For Each ctr In Me.Controls
Select Case ctr.ControlType
Case acTextBox, acListBox, acComboBox
If g_lAccessID = 6 And (left(ctr.Name, 3) = "txt" Or left(ctr.Name, 3) = "cbo" Or left(ctr.Name, 3) = "chk" Or left(ctr.Name, 3) = "l_") Then
ctr.Locked = True
Else
ctr.Locked = False
If g_lAccessID = 6 And left(ctr.Name, 3) = "btn" Then
ctr.Enabled = False
Else
ctr.Enabled = True
End If
End If
End Select
Next ctr
End Sub
' ***********************************************************************************************
Private Sub Form_Current()
Call CtlColors
End Sub
' *****************
Function CtlColors()
Dim dtrl As Control '<----------------
Select Case Me.cboGroup.Column(0)
Case "STU"
For Each dtrl In Me.Controls
If Me!cboCourseType.Column(0) = "NC" Then
If HasTag(dtrl.tag, "YW") Then
dtrl.BackColor = 8454143 '<--Yellow '<------- Error line
dtrl.ForeColor = -2147483640 ' Bold Black Font
End If
ElseIf Me!cboCourseType.Column(0) = "LA" Then
If HasTag(dtrl.tag, "YW") Then
dtrl.BackColor = 15243799 '<----Light Blue
dtrl.ForeColor = 16777215 '<----White font
End If
End If
Next dtrl
End Select
Exit Function
End Function
|