Webtechie said:
Hello,
I am used to developing in Excel. I am trying to develop in Access. It
is
taking forever. I'm trying to use VBA to do simple things.
with Excel, if I need to get a value from a userform, it is
frmEmployee.txtFirstname.text (intellisense kicks in when I press the
">.")
with Access, I am seeing examples of Forms!FrmEmployee!txtFirstname.value
with no intellisense.
Am I missing something or is this the proper way to reference a control's
value on another form? Why can't you use intellisense to see the controls
on
another form?
As you probably know, Access Forms are very different from Excel/Word
UserForms. I'm not too familiar with the use of userforms in Excel, but I
suspect that you only have one instance of any given form, and the forms
always exist and are always in scope. In Access, you can have multiple
instances of any given form, and the form doesn't even exist as an object
until an instance has been created.
When the form instance has been created and is in scope, intellisense
operates. However, the bang operator doesn't provoke intellisense; only
the dot operator. If I am programming an event procedure in a form's class
module, for example, I can write
Me.
.... and get full intellisense, including not only the form's properties and
methods, but also all the controls on the form and the fields in the form's
recordsource.
If I have an object reference to a Form object, it gives me intellisense for
the properties of an Access Form; so I can write:
Dim frm As Form
frm.
.... and intellisense will appear after I type the dot (.). Or I can write
this:
Forms("frmEmployee").
.... and again, I'll get intellisense for an Access form -- but not the
specific controls and fields of frmEmployee. This is one case where using
the bang, while more efficient (they tell us), is disadvantageous, because
typing:
Forms!frmEmployee.
.... will not give intellisense.
Note: If your form has a class module, then you can declare an object
reference to that specific class, and get full intellisense. For example,
Dim frm As Form_frmEmployee
Set frm = Forms!frmEmployee
frm.
.... will give you intellisense including fields, controls, and public
methods specific to that form. Be aware, though, that forms only have class
modules if they include VBA code.