From the course: Microsoft Access Essential Training (Office 2021/LTSC)
Editing table structure in Design view
From the course: Microsoft Access Essential Training (Office 2021/LTSC)
Editing table structure in Design view
- [Trainer] All of the objects that we're going to be creating in Access, have multiple ways to work with them. These are called Views and you can switch between the available views using the first button on the Home tab here. The upper half of the button will toggle between two default views, or you can use the bottom half of the View button to see any alternate views if there are any for your object. In tables, there actually are only two Views, Datasheet View, which is what we've been looking at and Design View, which will give us additional options for creating our table. Let's see how our customer's table looks in Design View by switching into that mode. Design View allows you to focus on the structure of your table. So you're not going to see any of the data that the table contains. Each of the fields are listed down in a column and their data types are listed in the next column. This makes it easy to see all of the important details at a glance without having to click around. You can see that all the fields in our customer's table are Short Text data types, except for the ID field, which is an AutoNumber data type. This third column is where we can put any description of the type of data that goes into each field. This is a great place to store any notes or reminders about each field and could be a very useful reference when you come back to edit your tables later. For instance, we can add a description to our phone number column. I'll go ahead and click in this cell here and I'll type in nine-digit phone number, including area code. This way we have an easy reference in order to remember how we want to store our phone number data. We can also add or modify the fields that make up our table here in Design View. In many respects, it's actually easier to create a table in Design View than it is in the Datasheet View like we did earlier in the course. If I want to add a notes field before the phone number for example, I'll click on the CustomerPhone number column in this box here on the left side of that to select that column. Then in the Table Design contextual tab, I'll click the button that says Insert Rows, and that'll insert a new row above. Now I can fill in the details for the new field of our data table. I'll call it Notes, for the Data Type I'll choose Long Text, and we'll give it column of description I'll press Enter to finalize that change and then I can click anywhere outside of that box. Now we can switch back into Datasheet View in order to see the change. I'll go back to the Home tab of the ribbon, I'll click the View button here at the top, and you'll notice it has now changed to indicate that we're switching into Datasheet View. When I do so, Access tells me that I need to first save the table. This is because we made a change to the structure of the table, which I'll go ahead and say, Yes, here that'll save the table and return me back into Datasheet View. Now we can see our new notes column has been added into the design. Let's go back into Design View by clicking this button again on the Home tab. Another thing that we can do is make changes to existing fields. The AutoNumber primary key is named ID, and I'm going to change this name to CustomerID. I'll just simply click in the cell and make that change. We can also alter our data types. For the CustomerEmail data type, it's currently storing it as a Short Text. I'm going to change this to a Hyperlink. From the dropdown menu, I'll choose the Hyperlink option, that'll make that change and then I can click off of it to finalize it. When you're changing data types, it's okay to upsize the field or translate to a compatible type, but you'll begin truncating data if you switch to a smaller type or choose one with less precision. In our case, translating from Short Text to Hyperlink won't result in any data loss, but changing from a decimal data type to an integer, would, since integers can only store whole numbers. The gray selection boxes to the left of each Field Name allow you to grab and rearrange the fields within the table. For instance, I'll grab the new notes column that we just added by clicking and selecting it there. Then I can click and drag and I'll drop it at the end of the table. Notice that we can also quickly identify the primary key of the table by looking for the key icon here in that first column. This is good information to know and it's something that really isn't readily apparent when looking at this table in Datasheet View. We're going to look at the Design View a little bit more in depth in the next few movies, including the bottom half of the screen, which deals with additional properties for each of our fields. Now because changing your view is a common task throughout Access, there's a bunch of additional ways to do it. From the Navigation Pane, you can right click on an object and in the pop-up menu, you'll see an option to switch your view there. The same applies to the object's name tab if the object is already open. For instance, I can right click on the Customers tab up here at the top and I have my View options here. And if the object is already open, you'll find a duplicate of the View button on the ribbon in the first contextual tab for the object. So for instance here on the Table Design tab, I have the View button, and this is the exact same View button that I see on the Home tab In the first position. Finally, down on the bottom right of the screen, there's going to be a couple of View icons that allow you to quickly jump from one view to the next. So we have lots of options to toggle our view between Design View and our Datasheet View. I'll go ahead and click this button here to switch back into Datasheet View. And once again, Access wants me to save those changes that I've made, I'll press the Yes button, and that returns me back. So now you can see that the CustomerEmail address column has been changed into a clickable Hyperlink. And if I click on any of these, it'll automatically open up my default mail program and start composing a message to that address. Let's go ahead and close this down and I'm not going to save changes to that email. Also, if I scroll over to the right in this data table, you'll see our Notes column has been moved to the end. So that's the table Design View. You'll use it anytime you want to make structural changes to your data tables.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.