Home and Learn: Microsoft Access Course
In previous lessons, you have been setting up your tables. Now, we can start to add data to them.
In the All Access Objects pane on the left, double-click your tblAuthors table. Make sure you are in Datasheet View. If not, click the Home Ribbon then the View item on the Views panel. Click inside off the FirstName field:
Enter Lee as the first name. Press the Tab key on your keyboard to jump the LastName field (or simply click inside of it. Enter Child as the LastName. This author has no middle name, so press the TAB key twice. This will move you down one row. You should see this:
Notice the plus symbol on the left, circled in red above. This plus symbol tells you that you have a relationship set up. Click the plus symbol to expand it. You'll then see the Books table:
So for every author in your table, you can enter a book, one book per row. You can enter as many books as you like for an author. For Lee Child, enter the following in the BookTitle Field:
Blue Moon
In the Book Genre field, click your dropdown list and select Thriller. Your table should look like this:
Now enter two more Lee Child Thrillers:
Past Tense
Killing Floor
Your table will then look like this when you're done:
Now enter a new author. (You can click the plus symbol again to contract the Lee Child books.) Click into the FirstName field below Lee. Enter Fearne. Press the TAB key on your keyboard to jump to the LastName field. Enter Cotton as the author's last name. Again, this author doesn't have a middle name, so you can just tab over it. Now enter the following three books. All are Self Help books:
Happy
Calm
Quiet
When you're finished, your table should look like this:
Now open the books table by clicking the tblBooks item in the All Access Objects on the left. You should see a list of all the books you've just entered:
Notice the ID fields. The one for Books is the Primary Key here. It's set to AutoNumber and they are sequential numbers. The AuthorsID field is the Foreign Key. Here, we can have duplicate numbers, because each number represents an Author: number 1 was Lee Child and number 2 was Fearne Cotton. You can see that they each have 3 books.
Let's enter some more records in our database. To do that, we'll use a form.
<-- Previous Lesson: Relationships | Next Lesson: Data Entry with Access Forms -->
Email us: enquiry at homeandlearn.co.uk