Error 2424

  • Thread starter Thread starter davidcoit
  • Start date Start date
D

davidcoit

Guest
Hello,

I am looking to change the color of text boxes on a subform based on the value of a yes/no textbox in the same subform.

Here is the code snippet:

Private Sub Form_Current()
Dim txtval As Boolean
If Me.Visible Then
With Me

.Repaint
DoCmd.GoToControl "BkrInit"

txtval = .BkrInit.Value
If txtval = True Then
With Me!CompanyName
.ForeColor = 255
End With
End If

End With
End If
End Sub

Everytime I open the main form, I get Error 2424 that says the database cannot find the value and directs me to the txtval = .BkrInit.Value.

I have used me.BkrInit, [BkrInit] and ("BkrInit") to access this textbox for the True/False value and continue to get the same error.
 
Try this:
Code:
Private Sub Form_Current()
    If Me!BkrInit Then
        Me!myName.ForeColor = vbRed
    Else
        Me!myName.ForeColor = vbBlack
    End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom