Current location - Training Enrollment Network - Books and materials - The method is very practical! Easily build a book management system with Access
The method is very practical! Easily build a book management system with Access
Task description: The purpose of this paper is to establish a personal book management system (including music CDs, data CDs and other e-books) through Access to help us manage each book well. This database can record the basic information of each book, add or delete book records at any time, and can also quickly find all kinds of information in personal collections according to different conditions. If classmates and friends can build such a database, it will be like a small library after the database is merged. Through the inquiry, you can see whether you have bought the books you need, and if you have, you can borrow them without repeated investment.

Note: This example uses the version of Access 2003, and the operation steps of other versions are similar.

Building a data "warehouse"

First, an empty "warehouse" (database) should be established, and then the data can be loaded into it.

Step 1: Start Access 2003, click the menu command file → New (or click the first "New" button on the toolbar), and click the "Empty Database" item in the "New File" pane on the right.

Step 2: Set the file name and save path in the new dialog box that opens. This example is named "Personal Book Management", and then click the "Create" button (see figure 1) to create a new database.

Planning and storing data with "tables"

After the house is built, it needs to be decorated to achieve better living effect, and so does the database. After the construction is completed, it needs to be well planned to save different types of data. In Access, "table" is the core of planning database, its main function is to save all data according to a certain structure, and other operations such as query and report can only be completed on this basis.

Step 1: First, plan the table structure. There is a lot of book information, and this example is just a demonstration, so the basic information data table of books created in this example only sets up several fields such as serial number, title, author, publishing house, purchase date, pricing, book category, medium and content introduction.

Step 2: As shown in Figure 2, click the Table button under Objects on the left side of the main database window, and then double-click the Create Table with Designer item on the right side to open the design view window. Enter the field name in the field name cell, click the data type cell on the right, and then set a type for each field from the drop-down list. In this example, the serial number is selected as "automatic numbering", the purchase date is selected as "date/time", the pricing is selected as "currency", the content introduction is selected as "remarks", and everything else is selected as "text". You can set the data type in the field properties at the bottom of the window. For example, the default length of "Text" data type is 50 characters, which is not enough for a long book title. You can change "Field Size" to 255 in its regular item, like the author's name, 20 characters is definitely enough.

Step 3: After setting all fields and data types, the data table framework is completed. Access suggests that each data table should have a primary key field to define relationships with other tables in the database. Click the serial number cell with the mouse, and then click the key icon on the toolbar to set the field as the primary key. Press Ctrl+S to save the data table. When saving the data table for the first time, the Save As dialog box will pop up. Enter the name of the data table ("Booking Basic Information" in this example) and confirm.