Re: Problem with form that thinks it a commandbutton (possibly?)
- From: Marshall Barton <marshbarton@xxxxxxxxxx>
- Date: Thu, 23 Feb 2006 00:14:05 -0600
Vlad wrote:
I have two forms in my database and one of them is causing me problems
as follows in parts of my code. Easier with an example:-
If I run this:-
Debug.Print "type = " & TypeName(Form_View_Projects_Actions(2))
Debug.Print "type = " & TypeName(Form_Form1)
I get the results
type = CommandButton
type = Form_Form1
Why does Form_View_Projects_Actions(2) seem to be a CommandButton? and
how do I get it to be a form again.
What are you tring to do?
Are you aware that the syntax formobject(N) refers to the
Nth item in the form's Controls collection? Probably not,
or you wouldn't be asking your question. What did you
expect it to mean? If the (2) is part of the name of the
form, then my advice is: since spaces and other
non-alphanumeric characters in names are a pain and it hurts
when you do that, don't do it ;-)
Another point. The syntax Form_nameofform actually refers
to the form's class module, which may not be the same as a
form being displayed on the screen. Also, that syntax will
fail on light weight forms that do not have a code module.
To refer to an open form, you should use the syntax
Forms!nameofform or to refer to any form, open or not, use
the syntax CurrentProject.AllForms!nameofform
--
Marsh
MVP [MS Access]
.
- Follow-Ups:
- Re: Problem with form that thinks it a commandbutton (possibly?)
- From: Andibevan
- Re: Problem with form that thinks it a commandbutton (possibly?)
- References:
- Prev by Date: Re: Problem with form that thinks it a commandbutton (possibly?)
- Next by Date: Query help
- Previous by thread: Re: Problem with form that thinks it a commandbutton (possibly?)
- Next by thread: Re: Problem with form that thinks it a commandbutton (possibly?)
- Index(es):