Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access Compiles without Control on Form??? 1

Status
Not open for further replies.

bainsteven

Programmer
Mar 25, 2008
2
I have never come across this before - and nor can I find anything ANYWHERE! Hopefully someone here knows about this...

My boss has an MS Access database which compiles fine and works correctly. When I try and compile the database on my laptop it fails as it cannot find certain Controls on some Forms.

Eg: Compile error on "Me.ControlName"

The error exists because (so it seems) that on my boss' implimentation - if the compiler cannot find a Control on a Form - it will search the underlying data to find the corresponding Field name (which works!). All controls are named the same as their underlying data Fields.

Therefore, when I come to compile - the physical Control names on the Form do not exist - but MY compilation fails as Access is NOT looking at the underlying available Fields to the Form.

Has anyone ever seen this before?

I cannot find a setting, registry update, Google answer, or forum discussion!

Many thanks,

Steve.

PS: Currently using MS Access 2007.
 
What about replacing this:
Me.ControlName
with this ?
Me!ControlName

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you PHV! That solved the initial compilation problem.

With further investigation I have found the actual issue is as follows:

To "patch" my version I delete my current Forms and Modules, and then import the updated versions from my boss' implementation. The error seems to occur if (at some point) the Control existed on his Form, but then he has since removed it (Access must remember that the Control USED to exist - and so compiles). When I copy his Forms into my implementation - the Control does not exist on the Form - and so compilation fails. As you suggested - replacing the "." with a "!" solves the issue (I assume this is because the "." is for context-sensative options (available in the VBA drop-down, such as Controls/Properties) and the "!" is to refer to the actual underlying data?).

To solve this issue completely we cannot do a bulk Find/Replace on "Me." to "Me!" as this will replace property/funtion calls. Any suggestions on a suitable way to handle this issue?

In the meantime, if I hit the compilation error, I will just replace the problem "." with a "!" and make a note of which Control(s) my boss needs to add and 'hide'... although this could cause problems when we distribute the software in case we miss any.

Cheers,

Steve.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top