Link to home
Start Free TrialLog in
Avatar of 4charity
4charity

asked on

Compile error: Method or data member not found

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
Avatar of 4charity
4charity

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of omgang
omgang
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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.