One of the many uses that Microsoft Access forms can be used for includes the ability to create your very own MS Access form wizard feature.
As you will be familiar with Microsoft Office in general, wizards are useful utilities that provide assistance for general users to complete a task that would otherwise take much longer to manually create step by step.
In MS Access alone, there are many wizard features around ranging from the query wizard to adding predefined (embedded) code for a command button.
Here’s an illustration of a custom form that I’ve built in the past which contains a four page screen for a user to scroll between using the navigation command buttons.
This wasn’t at all complicated and required very little Access VBA code too which developers then tend to save as a template style object for your Access forms offering various benefits to their databases.
Microsoft Access Forms – How To Build Your Own MS Access Form Wizard – The Steps
First of all, you will need to create a blank form and add a tab control to it specifying as many pages as you will need (I have used four pages).
Set the tab control’s properties to ‘no tabs‘ and position it to the top left corner and set the width size to the full width of the detail area of your blank form. Leave a small area at the bottom of the detail section to add some Command Buttons.
For convenience, I get into the habit of naming controls which always helps with coding later on and have named the main tab control as ‘tab‘ and each page as ‘Page1‘, ‘Page2‘ etc.
Next, add three Command Buttons:
1. The Cancel Button – which is a close form action normally as a standard embedded macro command with the ‘Caption‘ property set as ‘Cancel‘ and its ‘Cancel‘ property set to ‘Yes‘ so it will respond via the ESC key from your keyboard.
2. The Previous Button – which will contain an empty coded control for now with its caption as ‘< &Previous‘. Note the ‘&‘ which will underscore the character that follows, in this case the letter ‘P‘ and therefore responds as the accelerator key from your keyboard too.
3. The Next Button – which will be the same set up as the previous button (containing no code for now). Set its caption to ‘&Next >‘.
Don’t forget to name your new Command Buttons too; cmdNext and cmdPrevious!
I have also added a temporary label for each page with a caption to show which page number users are currently focused on. These will of course be removed when being used in anger.
Save your changes and continue with some basic microsoft Access database VBA code.
Code needs to be added to the two blank Command Buttons (Previous and Next buttons) which will test and navigate between pages.
Using the dynamic approach of counting the number of pages the tab control collection contains and using the current value for a page (starting at 0 for page 1), code below maybe easier to follow than simply trying explaining it all here.
Each Command Button will test to see which page is currently visible and set the status of the other Command Button (enabled or disabled) as well as changing the caption to ‘&Finish‘ for the cmdNext button if it’s the last page.
On each page turn (whether forward or backwards), the title bar (Caption property of the form) also changes indicating which page is active and the total number of pages this wizard needs to complete.
The above code is written this way so that if you wanted to add another two pages, the code wouldn’t require any modifications. It’s just good coding!
Finally, save your changes and test it out.
Of course you can further enhance the form by adding more control, colour schemes and enhancing code logic to help increase the richness for Microsoft Access forms (as your template).
If you would like my example, please email me by completing the contact form and add the narrative “Please send me your Access Form Wizard example” in the subject line and I will send a Zip file (it’s very small) to you.
Tags: access form design, building form wizard tool, how to build access forms, microsoft access forms, MS Access form, ms access forms
“If you would like my example, please email me by completing the contact form and add the narrative “Please send me your Access Form Wizard example” in the subject line”
I’ve tried to do that but I get the message, “Failed to send your message. Please try later or contact administrator by other way.”
Hi Giorgio,
I have sent you the zip to your email address.
Thank you informing me of the Contact page not working properly, I will get this seen to by Tech.
Anyone else wishing to contact me and the contact page still fails to work, please email directly at [email protected]
Please send me your Access Form Wizard example
Sent, thanks for the request.