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?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
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,
 
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,225
Members
448,951
Latest member
jennlynn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top