We help IT Professionals succeed at work.

Compile error: Method or data member not found

279 Views
Last Modified: 2013-12-25
I have a form that has a Call to a Sub MakeEditable. There are many fields listed, with an example of a few attached. This call has worked fine, until I replaced some of the field names with new names. They had not prviously existed on the underlying table - I am now using an underlying query. When the Sub goes to run, I get the Compile error message, with either "Enabled" or "SetFocus" highlighted, for one of the new fields. Any idea why this may be happening? The fields that were previously listed in the Sub are fine - no error messages. Also, the new fields are showing up and working as controls on the form
Comment
Watch Question

Author

Commented:
NOTE - This also happens in other subs on the form, in a save record_Click, for example (see first code example.)
ElseIf IsNull(Me.InsuredName) Or Me.InsuredName = " " Then
        MsgBox "Insured Name is required. Please enter a valid insured name", vbCritical, "Required Field"
        'Me.InsuredName.SetFocus
        Exit Sub
'ALSO
 
Me.InsuredEmail.Enabled = True
    Me.InsuredEmail.Locked = False
    Me.InsuredEmail.BackColor = WHITE
    
    Me.PrimaryContactName.Enabled = True
    Me.PrimaryContactName.Locked = False
    Me.PrimaryContactName.BackColor = WHITE

Open in new window

IT Manager
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Jeffrey CoachmanMIS Liason
CERTIFIED EXPERT
Most Valuable Expert 2012

Commented:
1. Please respond to omgang's post

2. Whenever your db starts to act funny, make a back up immediately!

3. When you add or change objects, you should always compile the code.
Close the DB, then reopen it.
Then run the Compact/Repair utility.
Then see if it works.

4. If not, then create a new blank db and import all of the objects into it.
Then see if it works.

5. Finally, if that does not fix the issue, then you may have to recreate the form.
Then see if it works.

JeffCoachman

Author

Commented:
Perfect solution omgang. The controls were not labelled properly. I guess I just assumed that they would take on the name of the bound field.

Jeff, thanks for the tips.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.