VBA - "Compile Error: Method or data member not found"

compiler-errors, ms-access, vba

Solution

Make sure that you are referring to the name of the control that you just added. It may not be the same as the field / column contained. On the 'Other' tab of the property sheet, you will find Name, that is the property you need. It is often different from the name of the control contained.

Problem

I have been developing an Access form to operate as a frontend for a SQL database. I have been working with a developer, and they added the following VBA code to our main form: ``` Private Sub Form_Current() If Me.NewRecord = True Then Me.Client_Name.Enabled = True Me.SSN.Enabled = True Me.DOB.Enabled = True Me.Prob_Fee.Enabled = True Me.Settle_Atty_Amt.Enabled = True Me.Settle_Date.Enabled = True Me.Final_Date.Enabled = True Else Me.Client_Name.Locked = True Me.SSN.Locked = True Me.DOB.Locked = True Me.Prob_Fee.Locked = True Me.Settle_Atty_Amt.Locked = True Me.Settle_Date.Locked = True Me.Final_Date.Locked = True End If End Sub ``` When I try to add a new variable to this statement `Me.Case_ID.Locked = True`, the following error is returned: Compile Error: Method or data member not found I'm not sure where to go from here.

Original source