Link to home
Start Free TrialLog in
Avatar of HKFuey
HKFueyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Access: Method or data not found

I am sending an email from a tabbed form, the body of the email includes some of the text fields on the form.
If I try compile I get 'Method or data member not found'
I am using 'me.myfield' but one text box is giving the error.
If I try print the field name in immediate window I get "Variable not yet created in this context"

The code works for 'Forms!Mform.mytextbox', does anyone know why this is? (Something to do with tabbed control on form?)
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

this means that you are using a control name (textbox Name) that is not in the form.
When you create a form/report using the wizard or drag fields from the available fields list on to the form/report, Access gives the control name the same name as the underlying ControlSource.  So, if the bound field is CustID, then the control name is CustID.  If you create the control by using the ribbon and selecting a control type and drawing it, Access gives the control a name like text287 or listbox85.  Good practice is to rename these controls at this time to meaningful names.
SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
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
ASKER CERTIFIED SOLUTION
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
most of the experts here will agree that if you are using one reference syntax, then stick with it throughout your entire code...
So you can actually accept your own post as the solution...
Avatar of HKFuey

ASKER

Misleading error made me look at wrong control
You can use my LNC Rename add-ins to apply the standard LNC prefixes to controls (there are versions for different Access versions).  It is a free download from my Website; the links below are for Access 2007 and up:

Controls only:
http://www.helenfeddema.com/Files/code63.zip
Objects and Controls:
http://www.helenfeddema.com/Files/code63.zip

(no points needed)