1. RELATIONAL DATABASES AND MS ACCESS

1.2.2 Adding New Rows

Try adding a new book to the Book table. You can add a new book by first clicking on the New Record button shown near the bottom of the window:

image

Figure 1.10: To add new record

 

To complete the action of adding a new book you must type values for callNo, title, and author. As a first example use a call number that does not appear for any other book. As we will soon see the Book table is designed in such a way that each book must have a different call number. Your addition will be successful if your book is given a call number that no other book has. When you add a new row, you must move the cursor out of the row for the addition to be completed.

As a second example try to add a new book, but this time, use a call number that already appears in the table. In this case MS Access will reject your new record. Try this and you will see a response similar to:

image

Figure 1.11: MS Access message for duplicate primary key value

 

The important part of this message for us is the part that refers to duplicate values or duplicate data. When we try to add a row with the same call number as some other row MS Access refers to the duplicated call number value. Note that you can press the Escape key to remove the new row from the table display. Soon we discuss table design where you will see that the call number field is designed to be the primary key of the Book table.

Adding a row to a table is also referred to as inserting or appending a row.

License

Share This Book