- View Offline
Combining the Form Wizard and layout views are easy ways to get started creating your database's forms, but the real power and flexibility lies in utilizing the full design environment for creating forms from scratch. Once you understand what's going on under the hood creating your own forms that need your exact specifications and needs will become second nature. Let's start by creating a Rolodex style employee directory for Two Trees. Now I've got a finished example here called rfm_Employees-Complete that we can take a look at to review the kind of direction that we are looking.
I will double-click on that to open it and you will see I have a scrolling form here that's showing me information for my employees table. I can scroll through here and see photos of all my employees, easily find their name, their phone number and email address, as well as their physical address, what department they are in, and their hire date. I also had a little bit of fun with some of the fonts and I put their employee number here and I put the name of the state that they live-in over here. I can see this list scrolls and I have got a header up here at the top that doesn't scroll. So this is the kind of thing that we are going to be creating. Now our finished version might look a little bit different because some of the design decisions that we make are going to be a little subjective.
So things might not be in exact same spot but that's okay, it's really flexible we can always change it up. So let's go ahead and close this down and we will start making our own form. First we will go up to the Create tab of the Ribbon and in the Form section we will click on Form Design. That will create a blank form editing session, where we can start working. The first thing that you want to do with starting a new form is connected to a data source. So I will go over here to add existing fields and I will click on that to open the window and I am going to click on Show all tables. This will show me a listing of all the tables that are in my database.
I can use the Plus symbol to expand the field, for instance I'll click the Plus over here next to tbl_Employees to see all of the fields within that data table. Let's go ahead and add a field to our form. I am going to click-and-drag FirstName and drop it in the Form area. Now when you click-and-drag a field into the form area we actually get two elements. The first one over here on the left is a label, basically this is just the name of the header from the table, the second one over here is a textbox, and this is where the data will appear as we scroll through our records. So this is what's going to get populated with the actual first name of the employee.
Now when we are moving elements around on the form, the behavior is slightly different than what you might have experienced in Publisher or PowerPoint or Word. We've got these handles around the edges, the one on the top, the three on the right, the one on the bottom and these two over here on the left side will all resize my object. For instance, I can click on this one in the middle to make it wider or I can click on the one down here to make it taller. If I click anywhere on the orange bar I will get this crossed arrow, I can click-and-drag to move my object around; but when I do, the associated label comes right with it, it maintains its same relationship.
If I click on the gray box up here in the top-left corner I get the same double-headed cross arrow, using that handle I can drag the two elements independently of each other. Now that they are in a different relationship and I tried moving it using the orange over here they will maintain that new relationship. So go ahead, I am going to move this around, I am actually going to put it underneath FirstName here, and now if I were to drag it around FirstName will come right with it. So that's moving objects around, it takes a little bit of getting used to because it is different from what you might have experienced before, but that's how all of the objects in Forms and Reports work.
Okay, let's add a couple of more fields to our form here. I have already got first name, let's go ahead and add LastName and I will click-and-drag these over, Phone number, this time I will just double-click and that will add it into the form. Address, City, State, Zip, Email, HireDate. I don't want everybody to see their hourly rate of pay, so I will skip that one, but I will do Department and Photo. Now that all of the fields are in my form I can go ahead and rearrange them into the positions that I want. Now all of these fields came with an associated label with it, for instance, I've got Photo here and then the Label photo.
Now this might be a little bit redundant, I don't need a label to tell me that this is a picture of the employee. So I can get rid of some of these. I am going to click on the Photo label and delete it. The same thing applies to the Address, I don't need a label that says City, State, and Zip; all I want is the one that says Address. So I will get rid of City, State, and Zip labels; same thing applies to the first and last name, I think that's going to be pretty clear so I will get rid of the FirstName and this LastName label as well. Okay, now I am going to start moving elements around. The first thing I want to do is get myself some space to work. So I am going to drag a box around all of these and just drag them out of the way.
I will click off to deselect and now I can grab each element and put it where I want. First I am going to drag the photo and put it in the top-left corner. And I will resize it a little bit to maybe about the one-inch mark and about an inch-and-a-quarter down. Next I am going to move the name to the very top. So I will start with the FirstName box which is this one here, move that up to there, and then I will move LastName up as well. I also want to give myself a little more room for the LastName, so I will make that box wider. Now below FirstName and LastName I want to put their phone number, I will take Phone and drag that up.
Now I am going to line everything up against the two-inch mark here, below Phone I am going to put Email. So I will click-and-drag that one up as well. Below that I will put their Physical Address, take Address, move it up. We will put City, State and Zip all on one line. So we will take City there, State here, and Zip next to it. Finally we will put HireDate and Department down in the bottom. HireDate and Department, we will put over here to the right. Now the grid in the background is kind of a snapping grid so when you move all this around they tend to snap to these corner points, that helps with the alignment and everything and keep everything spaced properly.
Next let's move these labels a little. Department, I need to move that closer, so I will use the handle here and we will drag that closer to department. HireDate, I am going to move that over as well, and we can drag to here. And we can use some of the tools up here on the Arrange tab to help us with the alignment as well. For instance if I select all of these labels at once by dragging a box around them, nope, but I don't want to select Photo, so I will deselect, just those labels here. I can go over to the Align menu in the Sizing and Ordering section, click that Down box and say I want to align everything to the rightmost object which is that HireDate box, and then I will move accordingly.
Finally I am going to make my Address field bigger. I know I am going to need more room for that so I will just drag that wider. And while I am here, Email address that should probably be wider as well. Up on the Arrange tab of the Ribbon, there are some other tools that could help us out. If I wanted to ensure that everything was lined up we've already seen the Align tab which will have us align everything to a specific object. I could also use the sizing and spacing which will help me resize everything to a common size or space everything so they are equally-spaced. Let's switch into the Form View to see how our form is looking. I will switch to the Home tab and press Form.
Now I can see the data is being populated in and I can scroll to my records here, we can see the photos, the names and all the data is being populated. So let's go ahead and save this form, I am going to save it as Employee Directory and you can either press Ctrl+S on your keyboard or press this disk icon up here, we will name this Employee Directory, and press OK. That will save it down on the Navigation Pane and we are going to continue working with this form throughout the rest of this chapter. Now we can continue to finesse these positions as we develop our form, and truth be told, form design will require a lot of back-and-forth if the final layout gets further refined.
Now that we have our Form Field elements in roughly the position that we want them, we can take a look at some of formatting options that are available. We will pick it up there in the next movie.
- Designing for the end user
- Organizing form elements
- Formatting a form
- Adding headers
- Linking to external content
- Entering and selecting data
- Adding charts
- Creating a main menu
- Creating a customer form
- Understanding report structure
- Building reports from wizards and queries
- Printing reports