473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

"Variable not defined"; VBA and Intellisense using outdated table schema

I can refer to some, but not all, of the fields in the RecordSource of a Form in the VBA code-behind. I have been careful to name the controls which provide data display/entry for the fields differently from the fields, and to name any variables differently from both fields and controls.

If I reference certain fields in an expression, I get a compile-time error "Variable not defined". Also, the same field names that throw this error do not appear in the Intellisense drop-down if I type, for example, "Me." to start an expression.

Looking through the fieldnames listed in the Intellisense drop-down, I note some entries there that have either been removed from the table or renamed; similarly, I note the absence in the list of some recently-added fields.

Finally, in the Form Design interface, the Control Source drop-downs for all controls show the correct, current list of field names for the RecordSource table.

It appears as though the VBA IDE is working from some stale, older version of the table schema -- it reflects the fieldnames as they were when the form was first designed, and does not reflect more recent changes to those fields and their names.

A specific example: my table dat_Tracts used to have a field in it called TractSub, and Form_Tracts had a control on it named cboTractSub whose ControlSource was TractSub. I subsequently renamed the field to TractSubCode, renamed the control to cboTractSubCode, and reset that control's ControlSource to TractSubCode. The form and control work fine, but if I try to reference TractSubCode or Me.TractSubCode in the VBA, I get the error. Furthermore, I note that Intellisense still includes Me.TractSub in its list even though there is no field nor variable with that name!

Does anyone recognize these symptoms? Is there a way to refresh/update VBA's "understanding" of the fieldnames? Or is there some other explanation (and fix) for this problem?

Sorry to be long-winded but I want to be clear that this does not seem to be a simple case of confusing control and fieldnames or the like.

Many thanks in advance,

Chris
Nov 12 '11 #1
3 2694
NeoPa
32,556 Expert Mod 16PB
BarksWorseThan:
Sorry to be long-winded but I want to be clear that this does not seem to be a simple case of confusing control and fieldnames or the like.
How can you even consider apologising for such a perfectly explained question? I'm almost shocked (but certainly impressed).

I've never noticed any such symptoms myself. I'm wondering if this might be because of some of the habits I have for dealing with my projects, but frankly that's a stab in the dark. I'd certainly be interested in seeing this behaviour for myself and maybe experimenting to see if I can determine what, if anything, it relates to. I don't have 2007 or beyond available at this time, but if you're interested in attaching a copy I'll link you to some preliminary steps that will help avoid wasted effort (Attach Database (or other work)).
Nov 12 '11 #2
Hi NeoPa,

It seems an honor, if a dubious one, to have stumped the Most Active/Most Answers member of this forum! I appreciate your offer to look over my work, and I may take you up on that but I am heading out of town tomorrow for most of this week and won't have time to prep it for you before I go.

Your comment about not having Access 2007/2010 gives me one idea to try: it turns out that I just upgraded to 2010 a few weeks ago; I wonder if opening it in 2003 (my previous version) would show the same symptoms or not? My guess is that it *will* have the same problem, but perhaps the exercise will give me some insight or clue. I don't recall the timing of the table mods (that are not showing up in VBA IDE) vis-a-vis my switch to 2010...

So, I'll be out of the loop on this for a stretch of days but will follow up on my return. Many thanks,

Chris
Nov 13 '11 #3
NeoPa
32,556 Expert Mod 16PB
I was hoping/expecting that the act of compiling the project explicitly (One of the steps involved from the link) would actually cause the issue to disappear. It probably comes down to what causes Access to rebuild its table of available objects within the project. My guess would be the Compile step, but I don't know for sure. I suggest you try that step as one of your first. Many of the other steps are often worthwhile anyway though. Good tools for general usage.

I'll see how you've managed when you get back. I'm still happy to look at it for you if it gets that far.
Nov 13 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: elektrophyte | last post by:
I was looking at the PHP function "call_user_func()" (http://us3.php.net/call_user_func). It appears that this will solve a design problem in the app I'm working on. (I'm writing a class that will...
2
by: Joe Cosby | last post by:
Thanks for all the help with the earlier questions I've posted I am trying to do something I've seen in other perl code bases but I don't know how they do it. You have a text -file- (html,...
8
by: harry | last post by:
Hi, During compilation, a C# project in my solution triggers the following warning: "warning CS0168: The variable 'ex' is declared but never used" To trigger this warning, it appears the C#...
8
by: TTroy | last post by:
I have a few questions about "scope" and "visibility," which seem like two different things. To me "visibility" of the name of a function or object is the actual code that can use it in an...
0
by: David Gresty | last post by:
I am developing a web applications that uses lots of data forms to display, input and update. During development, I have tested the code, adapters and datasets and they work great. Nearing the...
10
by: Eric G. Harrison | last post by:
We have a project with many other projects referenced (all of which are referenced at the project level and are included in the solution). Frequenly, if we make a change in project A (such as adding...
3
by: Jon | last post by:
I'm learning about datatables. When using the example provided by MS in the ..NET Framework Class Library for DATATABLE (see below) I get an error on line 3 that says "Type expected". Is something...
2
by: Yarik | last post by:
Hello, I am not sure the subject of my post adequately describes the problem I am trying to solve, so I think a specific example would be helpful. Let's say there are XML descriptions of...
11
by: mfglinux | last post by:
Hello to everybody I would like to know how to declare in python a "variable name" that it is in turn a variable In bash shell I would wrote sthg like: for x in `seq 1 3` do M$i=Material(x)...
3
by: moshe koren | last post by:
Hi, i'd like to have code blocks A and B if AB is defined and B and C block if BC is defined. is the writing below correct ? void func(...) { #if defined AB A
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.