Command Button to Switch Between Subdatasheets

Bench

Board Regular
Joined
Aug 27, 2009
Messages
134
Hi,

Very very new to Access, have some experience with excel vba but have learned most of this through the macro recorder, now i find out access doesn't have a macro recorder :(

My issue:

I have a database with contacts in (company name, address, phone number etc), each of these have three subdatasheets attached, what i would like to do on my entry form is allow the user to click one of three command buttons that will then show the relevant subdatasheet (People, Postcodes, Instructions) I imagine this is really easy wondered if anyone could give me a kick start please.

Thanks

Ben
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
Do you mean subdatasheets when you browse the table, or subforms on a main form?

Subdatasheets are not a good idea, nor is directly working with tables. You should instead create a form based on the main table, then create forms (in datasheet view) for the 3 related tables.

You then have several options. They include:

1. Add a Tab control and drag each subform onto a different tab. Switching between them is just a matter of clicking the appropriate tab

2. Make all 3 subforms exactly the same size, overlay them, and use button(s) to display the desired one

3. Only have one subform on the main form, and use code to switch the source object (ie, load a different subform).

1 is the easiest to set up, 3 gives the best performance.

Denis
 
Upvote 0

Forum statistics

Threads
1,187,107
Messages
5,961,633
Members
438,557
Latest member
Jadatutor

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
Top