Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
The forms that we have looked at so far have all been linked to a data source and pulled records from our databases tables. But forms don't always have to interact with data; they can be standalone elements that provide interactivity for your end users. In other words, a form can simply be a blank area where you can group buttons and capture user intent to help them navigate the database. When used appropriately, these types of forms can completely remove any need for your users to dig around in the navigation pane over here. You can control exactly what your users have access to and often more importantly what they don't have access to.
In this movie we are going to create a main menu that will help our end users to navigate the Two Trees database, we will start with a fresh, clean, blank form in Design View and add some buttons that trigger macros. Let's go ahead and go up to Create tab, and we will create a new Form in Design View. In the Property Sheet, if it's not open, you can press this button here. I will go to the Alt tab, we are just going to go down the list here and change some properties. The Caption I am going to change to Main Menu, with space in it. I am going to tab down to Pop Up, I am going to change that to yes, by pressing the Y key. I am going to go down here a few more. Allow Datasheet View, I am going to turn that to No, Pivot Table View to No, Chart View to No and Layout View to No.
And again, I am just tabbing through these, and I am pressing the N key to select No. I want to add a picture into the background, so I might go to the Picture property and I am going to click Build button here on the right. We will go to my Exercise Folder here, we are in the Chapter 4 section and I am going to choose Ojai500x333, this is a picture of the Ojai Valley in California where our olives are grown. I am going to go ahead and say OK. And that will add that image into the background of my form. Let's go down some more in the Property Sheet, I will go down to the Width Property. I want to make my form exactly the same width as my image, so I am going to choose 500 pixel, we will type in 500 px and press Enter.
The height of the form is a property of the detail sections, so we will change that in a moment, Auto Center, I am going to turn that to Yes, so it appears in the middle of my stream when it starts, I am going to scroll down some more till I get the record selectors. I am going to change No, Navigation buttons, I am going to change that to No. And I look like I just missed one, I am going to go back to Border style here, instead of Sizable, I am going to change that to Thin and that will make a really thin border around the menu system. I am going to go back down the scrollbars; I will change it from Both to Neither, so we don't get any scrollbars appearing. Okay, so let's go ahead and change the Detail section, so we can get the height.
I will click anywhere in the form back here, the Heights property is there for the detail section, and I what this to be 333 pixels or the same height as my picture. I will press Enter to apply that. And this point let's go ahead and save our form here, I am going to press Ctrl+S and we are going to type in Main Menu. Now it took the name right here from the name that I had saved as the Caption property. So that's a fine name for my form, I will just go ahead and say OK. Next I am going to add a couple of titles in here; we'll use our Label control for that. So I will go up and grab one label control, click down here and I am going to type Two Trees Olive Oil Company and press Enter.
I will add a second label below it here, and I will type in Main Menu, and press Enter. Let's go ahead and select both of them, I will press Shift and select the other one, and we will change their formatting. I will go to the Format tab, I will make them bold. I will change their color from that gray to a dark gray, maybe this one here, 15% black. I will make them right aligned, and I will change their font, to let's say 60. Now that I have changed the font, the text is a little bit bigger than the bounding box, so I can enlarge the bounding boxes together at once by clicking and dragging this left corner here, so I'll click and drag that open.
Now I can arrange them together, I'll go to the Arrange tab, Align to Right. And I'll deselect them all, I will click on the Main menu and I am going to make that little bigger by going to Format and I will change it's font to 20. Now I will move them into position, use the up arrow key to move that one, I'll Shift+Click on this one and then I will move them where I want to. Let's move it up and over to the right. Okay, those are in position now. Let's go ahead and add a couple of buttons to open up forms that are in our database. We will go to Design tab, use our button control with the Button button. We will add a button down into our detail section and the command button Wizard starts.
We are going to do Form Operations, open a form, Next, the form I want to open with this button is the Employee Directory, so go ahead and say Next. We are going to show all the records, so go ahead and say Next. And the text for my button, I want to be more specific than just open a form, because that doesn't have the end-user which form is about open. So I am going to say View Employee Directory. Go ahead and say Next and we will take default name and Finish. So there's one button, let's add a couple of more, we will grab another button, click below, we go to Form Operations, open a form, Next this time I want to open up the Review form, so click Reviews and say Next.
Will show all the records again, Next, and I am going to choose text for this one again, and once again, instead of open form, I am going to say Enter Product Review, go ahead and say Next and Finish. Let's add a third button down in the bottom, one more button here; we will click on the bottom, right? This time I am going to choose the Application category and the only action here is Quit Application and that will close Access. Go ahead and say Next. The text I want to say, instead of Quit App, I am going to say Exit Database. And say Finish. Now we can color these a little bit by going to the Format tab, instead of this blue button for the exit, I am going to change that with the quick styles to a red, to really call attention to it, it's like a stop button.
The other two, I will highlight both of them at the same time by pressing the Shift key, and I will change their style to a green color, maybe this green one here. Now we can arrange them to get them in the position. I will click the Arrange tab, the Size and Space button and then To Widest will make them the same width. Then I will align them together by going to the Align tab and saying Left. Then I can move them together, move them up a little and align both of them and I know they are aligned and they are all the same width. So I will just move these into position with the arrow keys. Okay, let's go ahead and test out our functionality now. I will go to the Home tab and click the form.
Now I have got a free-floating Main Menu system here with couple of buttons on it, let's test the buttons and see if they work. Now the Exit database one, that's in the close Access, so stay away from that for just a moment, but we will try to View Employee Directory button. When I click on that the Employee Directory opens, but this Main Menu is still in front of it. So we need to actually engineer these button a little bit differently. So that they provide the functionality that I'm expecting. Let's go ahead and close the Employee Directory and we will return to Design View for this Main Menu. But if I go to the Home tab now, you'll notice that Design View is grayed out here. Now that this is a free-floating window, I have to actually right-click in the window and say Design View from here.
Now if I click on the button and take a look at its Properties under the Event tab, the On Click event, this has this embedded macro, and this is what the Wizard created for us when we created the button. We can click the Build button over here on the right to edit the macro that was created. I will click on Build and we can see that the macro right now just has one step, it's opening a form, we will see that the macro just has one step right now, it's opening a form here and it's this Employee Directory form, it's the one that's opening. I want to actually add another step here. Let's go ahead and add a new action right here, we are going to use the Close Window action. Now the Close Window action will close the active window if I leave the Arguments blank, or I can specify a window that I want to close.
But if I leave it blank now, what's going to happen is, Access is going to open the Employee Directory and then close the active window, which since we just opened the Employee Directory, is going to be the Employee Directory. So I need to make sure that the Close Window property is first, so I will move it up in the list using this up arrow here. So now when I click on the button, it will close the active object which is going to be the Main Menu window, and then it will open the Employee Directory. Go head and close this macro and Yes I will save that change. We will do the same thing to the other button, I will click on it, click the Build button over here on the right. I will use the CloseWindow action and I will move it up on the list.
Go ahead and close and save your changes and now let's test it out, go back to Form view, on my window, my free-floating Main Menu here, I will click View Employee Directory. The first time I do that, since it's going to close this Main Menu, it's going to ask if I want to save my changes. So Yes, we are going to make sure we save that. And there is my Employee Directory. Now the last thing I need in order to make this a full circle, I need to provide a way to get back from my Employee Directory to the Main Menu. So once again we will go to Design View for the Employee Directory, we will add a button to the header up here, this is going to be Form Operations, open a form, Next.
This time we are going to open the Main menu form, Next. The text for that is going to be Return to Main Menu, Next and Finish. And again, we will need to change that macro a little. So the On Click event in the Properties will go to the Build button here, we will add Close window and we will move that up to the top, close the window here, and we'll save that macro. I am going to change the style of the button here; I will go to Quick styles and choose the same green, just so we are consistent throughout this. Go to the home tab, view our form and I could test out that button.
It's going to ask me if I want to save the Employee Directory changes, so Yes, and there we go. Now I can view the Employee Directory, when I am done looking for the record I am looking for, return to Main Menu, and then back to where I started. And as our database grows, as we add additional functionality through other forms and reports over here, we can return to this Main Menu form and add additional navigation buttons that will get our users to where they need to go and back.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 75213 Viewers
80 Video lessons · 130049 Viewers
52 Video lessons · 64197 Viewers
59 Video lessons · 49997 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.