How to Use VBA Command Buttons to Select Tab Control Pages in Access
Question details
The user needs to hide the default tab control buttons on a Microsoft Access form and navigate between specific tab pages using custom command buttons and VBA.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Customizing form navigation interfaces or resolving right-to-left layout display issues by replacing default tabs with custom interactive buttons.
- Observed behavior
- Standard tab buttons do not meet the user's design or layout requirements, necessitating a VBA-driven custom navigation approach.
Before modifying your form's design, save a backup of your Microsoft Access database and ensure that your Trust Center settings allow VBA macros to execute.
Replace Default Tabs with Custom VBA Command Buttons
Hide the default tabs on your tab control and write a simple VBA script on the On Click event of custom command buttons to switch between pages.
By setting the Style property of the Tab Control to 'None', you can hide the standard tabs while keeping the pages active. You can then use command buttons placed on the main form body to change the Value property of the tab control, navigating through the zero-indexed pages.
Open your Access form in Design View. Select the Tab Control by clicking the edge of the control (not a specific page). Open the Property Sheet (F4), go to the Format tab, and change the 'Style' property from 'Tabs' to 'None'.
From the Form Design toolbar, select the Button control. Click on the main form area (outside of the Tab Control) to place your buttons. Create one button for each tab page you want to navigate to.
Select your first command button. In the Property Sheet, go to the Event tab. Click the ellipsis (...) next to 'On Click' and choose 'Code Builder'. In the VBA editor, type: Me.YourTabControlName.Value = 0 (replace 'YourTabControlName' with the actual name of your tab control).
For the second button, use Me.YourTabControlName.Value = 1. Continue this pattern for all buttons, incrementing the index number by 1 for each subsequent page.
Save your VBA code, close the editor, and switch the form to Form View. Click your new command buttons to ensure they seamlessly transition between the hidden tab control pages.

Looking for a Lightweight Microsoft Office Alternative?
While this specific issue pertains to Microsoft Access databases, if you are looking for a highly compatible, lightweight, and cost-effective solution for your everyday document, spreadsheet, and presentation tasks, WPS Office is an excellent choice. It offers seamless format compatibility and a familiar user interface without heavy subscription fees.
- 1. Download WPS Office: Visit the official WPS website to download the free, lightweight installer.
- 2. Install and Launch: Follow the simple on-screen instructions to install WPS Office on your device.
- 3. Open Your Office Files: Seamlessly open, edit, and save your existing Word, Excel, and PowerPoint documents with zero formatting loss.

Frequently Asked Questions
Why do my command buttons disappear when navigating to a new tab?
If your command buttons vanish when you click them, they were likely placed inside a specific tab page rather than on the main form body. To fix this, cut the buttons in Design View, select the main form background, and paste them outside the tab control.
Can I use Access macros instead of VBA to navigate tab pages?
Yes, you can use the SetProperty macro action in Access to change the Value of the Tab Control to the desired page index. This is a great alternative if your database environment restricts VBA code or if you prefer a no-code approach.
How can I reference a tab page by name instead of its index number in VBA?
You can reference a specific page by its name by using the SetFocus method in VBA. Instead of changing the tab control's value, you can write: Me.TabControlName.Pages("YourPageName").SetFocus to bring the targeted page to the front.




