Subform naming - best practise

Gavx

Registered User.
Local time
Today, 17:16
Joined
Mar 8, 2014
Messages
155
What is good practice concerning the naming of the subform control and the name of the form that sits in the control?

I have named them the same, that is sfmMySubform, but perhaps this is confusing.

Perhaps I should call the subform fmMySubform?
 
Forms: frmXXX
Sub Forms: subfrmXXX or sfrmXXX

Indicate whether it is a form or sub form in the prefix part so that they are listed together. What is important is the once you settle with the style, stick to it all the time.
 
Perhaps I wasn't clear.

Is best practice to name the following way;

Subform control; sbfNameX

and the subform that sits in the subform control; fmNameX - or should it be sbfNameY
 
I see no reason to name them differently - never heard of any conflicts arising from this. AS to subforms themselves, I prefer postfix instead of prefix, so as to group the subform in listings with the form it belongs to, so:

frmMyForm
fmrMyFormSomethingSub

Eg:

frmOrders
frmOrderDetailsSub
 
Perhaps I wasn't clear.

Is best practice to name the following way;

Subform control; sbfNameX

and the subform that sits in the subform control; fmNameX - or should it be sbfNameY

Oh, I get it. My preference is using the same name for the control and control source. But in some cases you may want to use the same control (place holder) for several sub forms.

AS to subforms themselves, I prefer postfix instead of prefix, so as to group the subform in listings with the form it belongs to, so:

frmMyForm
fmrMyFormSomethingSub

Eg:

frmOrders
frmOrderDetailsSub

Yes this is a good way to bunch all related forms and subforms together. In my case, however, I have a number of subforms that are used in different forms. So, for the sake of simplicity, I list them all alphabetically.
 
frm or sfrm is a bit arbitrary since the same object can be used as main form or as the SourceObject of a subformcontrol. I don't bother with either. It can be referred to via the AllForms Collection, as a main form via the Forms Collection so its object type is blindingly obvious without adding a prefix. As a subform it is referred to via the name of the subformcontrol and the form object's name is irrelevant to any reference.
 

Users who are viewing this thread

Back
Top Bottom