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!

Textbox is disabling itself for no apparent reason. 1

Status
Not open for further replies.

amcg

Programmer
Jan 25, 2002
26
IE
Hello all. I have a mystifying problem. A textbox on a form disables itself periodically for no apparent reason. There is no reference to the textbox in any code behind any button or form in the entire database, and I'm completely stumped. Users need to be able to copy the data in this textbox to use in a search engine. It was working fine up to 3 weeks ago, and the problem seems to be getting worse.

Any help would be appreciated.
 
Even if there is no reference to this text box by name, it may still be being disabled by code. For example, it could be referenced as Screen.ActiveControl while it has the focus. Or, it could be referenced as Me!Controls(n) or Me!(n) where 'n' is the numeric index of the control within its form's Controls collection. If you're referencing collections using numeric indexes this way, look for a bug that leaves your index set to the wrong value.

One approach to solving this is to look at every bit of code that sets an Enabled property to False. If you can't tell which control or object is being affected just by looking at that one statement, it may be that the object isn't what you think it is. Try setting up a watch breakpoint on that statement. For example, if the statement is:
cntrl.Enabled = False
then right-click it, choose Add Watch..., set the Expression to 'cntrl.Name = "TextBoxName"', and choose Break When Value is True. (These instructions are for Access 2000; I'm not sure you can do this in Access 97.) Then just play with the database until the text box goes disabled. If you get a breakpoint, you can backtrack to see why 'cntrl' is referring to your text box. If you don't get a breakpoint, delete the watch and try another statement that sets .Enabled to False. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top