Data Entry: Embedded Subforms versus cmdButton Open Subforms

liam_conor

Board Regular
Joined
Oct 9, 2002
Messages
180
I have a main data entry form which has many embedded data entry subforms. I want to remove the embedded subforms from the main form and use command buttons to access them for data entry. Any ideas on how to accomplish this? Any articles you know of?
 

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

VicRauch

Well-known Member
Joined
Mar 23, 2006
Messages
2,032
Removing the embedded subforms will speed up the opening of your main form, and as each sub form opens by itself, it will open quicker than all sub forms openning together.

I have one application that has only 1 subform object on the main form, and which ever tab is selected, I use the Change event for the tab control to see which tab was selected, and then set the SourceObject property to the form name to use as the subform. The code to see which tab was selected is:
Code:
Select Case Me!TabCtl0.Pages(Me!TabCtl0.Value).Name
  Case "Customers"
    Me.SubFormControl.SourceObject="frmCustomers"
  Case "Orders"
    Me.SubFormControl.SourceObject="frmOrders"
End Select
Of course this is sample only for a two tab form for Customers and Orders. In my sample here, the name of the subform control is "SubFormControl" (I know, not very original).

If you want to use buttons rather than a Tab Control, then within the button's OnClick event, all you would need is the "Me.SubFormControl.SourceObject="frmCustomers" statement. Be sure to change the form name to the actual subform you want loaded as your subform.

If you are using the Master and Child link fields between the master form and the subform, you should set those with the VBA code for each button too.

HTH,
 

Watch MrExcel Video

Forum statistics

Threads
1,113,811
Messages
5,544,451
Members
410,612
Latest member
MrACED
Top