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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Odd VBE behavior, some properties lowercase 2

Status
Not open for further replies.

Eupher

MIS
Jul 18, 2002
1,724
US
I have a form with several fields which are disabled by default. Depending on the user's selection in a combo box, some of the forms are enabled in the combo's After Update event. Everything works, there's no problem. However, I noticed today that in the code window for the form that the ".Enabled" property on all the fields is now displaying as ".enabled". If I delete or backspace through the ".enabled" to the dot, the little property popup pops and displays all the choices exactly as expected. If I select "Enabled" it puts it in the code, but as soon as I move the cursor to another line, it changes to lowercase. Other properties for the fields, such as .Visible or .Locked display normally, i.e. initial capital. Again, as near as I can tell, the code runs normally. It just makes me nervous when the VB code environment starts behaving strangely. Anybody have any insight? Thanks!

Ken S.
 
Hi Ken,

This will happen if you once saved your DB with a variable named enabled with a lower case 'e'. You can do this with any property, to test this try it with the Visible as well. On a test form you could create a control called whatever, lets say txtTest. In any event add the code txtTest.Visible first and note that the V is capital. On a seperate line type in Dim visible with a lower case v and the Visible will then be turned to lower case as well. If you don't save the addition of the Dim visible then when you reopen your DB the Visible will be Upper case again but if you save your db with the variable defined then the visible will remain lower case.

Regards,
gkprogrammer
 
I was able to reproduce this in a test database (not my production database), as you described. I searched all the code in my production database for "enabled" but couldn't find anything out of place. I suppose it's possible that one time or another I may have left a line uncommented or something and saved the DB before I discovered my mistake. I can't believe I would have intentionally named a variable "enabled", but when one has been at it long enough without a break, who knows what tricks the mind can play.

Do you know if there's any way to restore things to normal once this has occurred? Thanks for the assist...

Ken S.
 
Hi Ken,

The obvious way to change it is to add a Dim Enabled (upper case E), save your database, reopen it and delete the declaration.

But what remarkable behaviour. I wonder what else remains buried deep in the subconscious of an Access database?

Enjoy,
Tony
 
Hi, Tony:

Tried that, didn't work. Once you save it that way, it seems the property displays as lowercase forever, even once the declaration is removed. The one thing I tried that DID work was to make a new DB and import the objects from the old DB. It still displayed as lowercase, but if I deleted the property and re-entered it, then it displayed as normal. Not sure I'm willing to go to the trouble with my production database, as long as everything works. Maybe I'll just convert it to an .mde, so if I can't see the code, maybe it won't bother me anymore. ;-)

Yes, remarkable behavior.

Ken S.
 
Hi Ken,

Well that's odd, I was going to suggest the exact same thing that Tony did. I quickly tried this on a test form and it worked as expected, the Enabled was back to UpperCase after saving the DB with a variable named Enabled with an uppercase 'E'.

Regards,
gkprogrammer
 
Doh! I need new bifocals. Of course that's exactly right. I misread Tony's suggestion to mean just delete the declaration of the lowercase "enabled" and all would return to normal. Some days I'm smart; apparently today is not one of those days. ;-)

Stars for you both. Thanks!

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top