The Me.Namespace doubt

R

Raymond

Hi,
Why is that any object ( be a textbx,lbl,combo...anything..) created in a
form is included only in the "Me." namespace and not in the form (as in
form1.custbox, form2.empaccess....etc.) Is it due to the fact that VBA is a
bit different from VB coding?? I've done coding in vb.net and in that case,
evry form had its own properties but in VBA, only the ME.<namespace> is
available for accessing properties..
 
C

Christopher Robin

Have you actually attempted to call the FQN of the control?

I.E. Forms!form1!custbox
 
R

Raymond

Well, i don't think it works like this in VBA((Forms!form1!custbox)). This
u're talking about the expression builder. When you type in VB Editor, it
should appear as Form1.<then the properties should be displayed>
 
R

Raymond

Hmm ok...Thnx for the help..

Chris O'C via AccessMonster.com said:
Those objects are controls on the face of the form and can be referred to in
code by using the Forms collection, the form name, and then the control name.
Like this:

Forms!MyForm.txtStartDate

That's taken from VB code rules, not VB.net code rules. Don't confuse the
two programming languages. There's no namespace in VB or VBA, but there's a
container object in Access VBA that contains all the collections of objects,
including forms, reports, modules, tabledefs, etc.

Chris
Microsoft MVP
 
R

Raymond

That thing i already preform before writing the code. I open the form
1st...then build an event in it...

Chris O'C via AccessMonster.com said:
I should probably mention that under VB coding rules, the controls on the
form can't be referenced in code unless the form becomes a member of the
Forms collection. The form joins the Forms collection when it's opened. So
if the form isn't opened first, Forms!MyForm.txtStartDate won't be accessible
in code.

Chris
Microsoft MVP

Hmm ok...Thnx for the help..
Those objects are controls on the face of the form and can be referred to in
code by using the Forms collection, the form name, and then the control name.
[quoted text clipped - 17 lines]
evry form had its own properties but in VBA, only the ME.<namespace> is
available for accessing properties..
 

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