VBA Object Required Error: Not sure why this isn't working. I've used this code in the past.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Private Sub Form_Current()
If Me.NewRecord Then Exit Sub
Me.CursorHold.SetFocus
If Me.SelYear = "ALL" Then
Call LockUnlockForm(True, "#D5D5D5")
Me.lblLock.Visible = True
Else
Call LockUnlockForm(False, "#FFFFFF")
Me.lblLock.Visible = False
End If
End Sub
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Private Function LockUnlockForm(ynEnabled As Boolean, strColor As String)
If IsNull(Me.ProjectName) Then Exit Function
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.Tag = "LockUnlock" Then
If ctrl.ControlType = acTextBox Then
crtl.BackColor = strColor <<<<<<<<<<<<<<<<<<<<< Run-time Error 424 Object Required
End If
ctrl.Locked = ynEnabled
End If
Next
End Function
Our community of experts have been thoroughly vetted for their expertise and industry experience.