X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Referring To Properties And Controls On Subforms, Wiki Talk    
post Mar 14 2016, 06:38 AM

Posts: 0
Joined: --

This topic is designated for discussion of the article: Referring To Properties And Controls On Subforms.
Go to the top of the page
post Mar 14 2016, 07:56 AM

UtterAccess VIP
Posts: 7,993
Joined: 24-May 10
From: Downeast Maine

There are a few things that could be clearer to a person not already familiar with the topic:

The fully qualified name is not needed for VBA. If the code is in frmMain it can be Me.ControlName. The article suggests that Forms!frmMain!ControlName is the required syntax in any case.

Taking that a step farther, for the subform it can be Me.SubformControlName.Form.ControlName. Again, the article suggests the need for Forms!frmMain!SubformControlName.Form!ControlName in this case.

Many code examples use the Me syntax, which is not mentioned in the article.

Controls (and fields) are properties of the Controls and Fields collections, but are also properties of the form or report. The bang can be used, but the dot also works, and has the advantage of invoking the Intellisense options. While the distinction is a bit subtle, so many code examples use Me, then use the dot for the control or field name, that I think it would help if the article describes that distinction.

After describing the use of Forms! etc. in the article the code example uses a different syntax: Forms(strForm) etc. where strForm is a variable. This is a valuable technique, but could use some further explanation. For instance, it would make sense as a way of referencing a value on a form not connected to the current code module (i.e. not the current form, or a parent or subform), but not so much as a way or working with a value on the current form.

Also worth mentioning is that only the fully qualified name will work in queries or text box expressions; or from another angle, Me. can only be used in VBA.
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    6th December 2019 - 03:53 PM