Prev: INSTR search problem
Next: Pictures
From: Karl E. Peterson on 15 Jun 2010 13:29 Jeff Johnson submitted this idea : > "Karl E. Peterson" <karl(a)exmvps.org> wrote... > >>> Hey, I can do this >>> >>> Debug.Print Forms(1).Controls("txtBox").MaxLength >>> >>> but I can't seem to do this >>> >>> Debug.Print Forms("frmMain").Controls("txtBox").MaxLength >>> >>> Is there a syntax to access form objects by name rather than by index? >> >> No, because there can be multiple instances of a form. (And hopefully none >> of them are the default!) > > Feh. If there's only going to be once instance of a form I ALWAYS use the > default. (Well, unless it's a dialog box. Then I create a variable.) I got out of that habit years ago, because doing so eliminated all sorts of phantom problems with object lifetimes. -- ..NET: It's About Trust! http://vfred.mvps.org Customer Hatred Knows No Bounds at MSFT ClassicVB Users Regroup! comp.lang.basic.visual.misc Free usenet access at http://www.eternal-september.org |