VB Editor and Capitalization

V

victorcamp

Where and how does the Visual Basic Editor in Access save its capitalization
conventions for user-defined variables and constants?

By that I mean: When I declare a variable or constant, every instance of it
automatically matches the capitalization of the declaration. That's good. If
I later change that variable/constant, they all snap into the new format.
Also good. However, if a field name, for example, happens to match that
original spelling, it will snap into that now-gone format, regardless of the
field's own capitalization in the table.

For example:
Const CUST_ NAME As Integer = 0
Later I change that to:
Const CUST_DESC As Integer = 0
"CUST_NAME" now no longer exists in the code.
Then I use a field name in the code:
strRetVal = rst![cust_name]
The VB Editor immediately flips it to:
strRetVal = rst![CUST_NAME]
Nothing I do can force it to leave it as written!
 
M

Marshall Barton

victorcamp said:
Where and how does the Visual Basic Editor in Access save its capitalization
conventions for user-defined variables and constants?

By that I mean: When I declare a variable or constant, every instance of it
automatically matches the capitalization of the declaration. That's good. If
I later change that variable/constant, they all snap into the new format.
Also good. However, if a field name, for example, happens to match that
original spelling, it will snap into that now-gone format, regardless of the
field's own capitalization in the table.

For example:
Const CUST_ NAME As Integer = 0
Later I change that to:
Const CUST_DESC As Integer = 0
"CUST_NAME" now no longer exists in the code.
Then I use a field name in the code:
strRetVal = rst![cust_name]
The VB Editor immediately flips it to:
strRetVal = rst![CUST_NAME]
Nothing I do can force it to leave it as written!


Those things are stored internally and I imagine they are
not cleared when you delete a name's declaration because it
would cause a lot of complexity in the name management
process. (I'm thinking hash table or B-tree where removing
an entry requires reconstruction of part or all of the name
space memory.)

When I run into this irritating behavior, I just add a
declaration with the now desired capitalization and then
remove the line I just added.
 
V

victorcamp

Your idea works great! It's so simple, yet exactly what I need.

Marshall Barton said:
victorcamp said:
Where and how does the Visual Basic Editor in Access save its
capitalization
conventions for user-defined variables and constants?

By that I mean: When I declare a variable or constant, every instance of
it
automatically matches the capitalization of the declaration. That's good.
If
I later change that variable/constant, they all snap into the new format.
Also good. However, if a field name, for example, happens to match that
original spelling, it will snap into that now-gone format, regardless of
the
field's own capitalization in the table.

For example:
Const CUST_ NAME As Integer = 0
Later I change that to:
Const CUST_DESC As Integer = 0
"CUST_NAME" now no longer exists in the code.
Then I use a field name in the code:
strRetVal = rst![cust_name]
The VB Editor immediately flips it to:
strRetVal = rst![CUST_NAME]
Nothing I do can force it to leave it as written!


Those things are stored internally and I imagine they are
not cleared when you delete a name's declaration because it
would cause a lot of complexity in the name management
process. (I'm thinking hash table or B-tree where removing
an entry requires reconstruction of part or all of the name
space memory.)

When I run into this irritating behavior, I just add a
declaration with the now desired capitalization and then
remove the line I just added.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top