Table Creation in Datasheet View


Fields Names

Once a table displays in Datasheet View, you can simply start entering data into its cells but because the columns would have insignificant names, you should make sure they display names that can identify their type of information.

A field can have almost any name: "Book Title", "This Is The Book Title", "My Book Titles", etc. Some of your fields will have only tinny data, like a person's age, the number of books in an office, a person’s middle initial, etc, it might not be a good idea to give them a name that would take too much space. In the future, when you start programming, it would be easier to handle field names that are composed of only one word, without an empty space.

To name a field, first figure out what the data in the category will be made of. If you are planning to enter employees' salaries in a field, you can just call the field Salary. If you want to specify employees’ names by first name, middle name, and last name, you can use such field names and make them distinct. In this case, you could name the first field as firstname (in one word), the last name would be called lastname. Although this good technique allows you to use one word name, some people including yourself might be confused. The suggestion is to distinguish wherever a new English 

(or the language you are using to design your database) name starts in the field name, by using a starting uppercase. Instead of firstname, you can use FirstName. Instead of fullname, you can use FullName. Instead of firstdayofmonth, you can use FirstDayOfMonth.

To change the name of a field, you can click its column header, such as Field1. You can also right-click a column and click Rename Column. Alternatively, when any cell under a column has focus, on the main menu, you can click Format -> Rename Column and type the new desired name.

Practical Learning: Naming Datasheet Fields

  1. Double-click the header of the first field: Field1. When it is highlighted, type OrderDate and press Enter
  2. Click anywhere under the Field2 column to activate it
  3. On the menu bar, click Format -> Rename Column. That puts the field name in edit mode
  4. Type OrderTime
  5. Right-click Field3 and click Rename Column from the context menu
  6. Type Container and press Tab



The Name of a Table

Like everything that is part of a database, a table must have a name that can be used to refer to the object throughout the database in other files that can be linked to the table. Fortunately, when you perform data entry, information you type into a table is saved immediately, as soon as you move to another cell. There are two main ways you can specify the name of a table, either when you save it for the first time or if you decide to rename it.

To save a table you have just created, on the main menu, you can click File -> Save. You can also press Ctrl + S. You could also perform a trick by trying to close the table. You would be prompted to save the table (if its structure has been changed from the structure it had before it was opened).

If a table has not been saved before, you will be asked to provide a name for the table. A table can have any name. With the same concerns we had when creating field names. This time also, there are suggestions made to you. First, the name of a table should reflect the kind of data it is holding. Second, you can name a table with a few words, with spaces; but for the same reasons mentioned earlier, keep the name of a table in one word. The last suggestion sometimes states that you use a prefix that identifies the table as such, a table. The name of a table would be preceded with tbl. If the name includes one word, such as Musicians, you can give the table a name like tblMusicians, another name would be tblStudents. If the name of the table reflects a combination of words, such as Bank Accounts or Students Academic Numbers, start each new word with an uppercase. Here are examples: tblBankAccounts, tblStudentAcademicNumbers, tblMemberRegistrations.

Unlike the previous version of this site, we will not use the convention of prefixing the name of a database object with a three letters. For example, the names of tables will not start with tbl. We came to this decision because most other database environments, including Microsoft SQL Server, do not suggest this rule. Although the lack of this rule may create some confusion, because you will end up having a table and a form with the same name, we will strive to explicitly state what object type we are referring to. For example, we will avoid writing, “Open Employees” or “Open the Employees object”. Instead, we will usually state, “Open the Employees table”. This should clearly indicate that you must first click the Tables button in the Database Window because the tables are only in the Tables section, and then open the indicated table. In the same way, if we write, “Open the Employees form”, you must first click the Forms button in Database Window, then open the indicated form.

Practical Learning: Saving a Table

  1. On the Table Datasheet toolbar, click the Save button to save the current table
  2. Type CustomersOrders and press Enter
  3. You will receive a long message box. Click No
  4. To close the table, click its system Close button

Previous Copyright © 2002-2004 FunctionX, Inc. Next