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?)
HKFueyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
this means that you are using a control name (textbox Name) that is not in the form.
0
PatHartmanCommented:
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.
0
Jeffrey CoachmanMIS LiasonCommented:
And also, lets be clear...
Can you post the full code please?
So we can see exactly what you are doing...

Also, what error are we troubleshooting?
Method or data not found
or:
Variable not yet created in this context

Method or data not found
In at lease two occasions, this has happened to me.
I had to delete the control, ...Compile the code, ...run the compact/repair utility and recreate the control.
I say this because you say the code Does work when you fully qualify the Control (Forms!Form.Control), ...and this is only happening for one control/textbox.


As just an FYI:
"Method or data not found" sometimes means you are trying to use a method that does not exist for an object.
For example:
Me.Label31.ControlSource = "Junk"
...Note that Labels do not have a "ControlSource" Property...

...Or the property is misspelled, for example:
Me.Label31.Captoin = "Junk"
...Here the word "Captoin" is a misspelling of "Caption"

JeffCoachman
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

HKFueyAuthor Commented:
Hi Jeff,

I deleted my text box, removed if from the code. did a compact repair then added a text box with the same name.
I still got the compile error, so I renamed the text box and changed the code, still got the compile error.

So I went through each line of code and checked the prompt after me. to be sure the field was referenced and I noticed a few lines above there was a field without 'me.' in front.

It's fixed now but I was confused as the field in the error was fine!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
most of the experts here will agree that if you are using one reference syntax, then stick with it throughout your entire code...
0
Jeffrey CoachmanMIS LiasonCommented:
So you can actually accept your own post as the solution...
0
HKFueyAuthor Commented:
Misleading error made me look at wrong control
0
Helen FeddemaCommented:
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)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.