The Records of a Database


Data Entry Fundamentals



After creating a table and its column(s), you can populate the database with data. You and the user can use either the table or the form but as mentioned previously, the form is sometimes the appropriate object to do this. Data entry consists of filling a database with the necessary values. A series of values that corresponds to same levels of columns is called a row or a record.

To enter data in a table, after displaying it in the Datasheet View, the user can click a box under a column and type the necessary value. After entering data in a box, the user can press Tab or Enter to move to the next box on the right. Whenever the user enters a value and moves to the next box, Microsoft Access automatically saves that value and it becomes part of the record.

When either all horizontal boxes have been covered or the user simply decides to move to another horizontal range of boxes, he or she is said to have created a record. In summary, a record is a series of the same horizontal boxes. A record is actually represented as a row. The intersection of a column and a row is called a cell. This means that data is actually entered into cells.

New Record Addition

By default, if you generate a form based on a table and intended for data entry, all records would be accessible. When it's time to add a new record, the user must move from one record to an empty one. An alternative is to create a form specially made for data entry. This type of form comes up with empty controls and expects the user to simply enter the new values.

To create a form for direct data entry, you have many alternatives. One of the techniques you can use to create a data entry-only form is as follows:

  1. Generate a form based on the table that holds the information
  2. Set its Navigation Buttons property to No and its Data Entry property to Yes

You can also allow the user to open a form for data entry, that is, to a new record. To do this, you can call the GoToRecord() method of the DoCmd object. The syntax of this method is:

GoToRecord(ObjectType, ObjectName, Record, Offset)

The first argument to this method must be a constant value. In this case, it would be acDataForm. If you are calling it to act on the current form, you can set this argument to acActiveDataObject. In this case, you can omit this argument.

The second argument is the name of the form to which the new record will be added. If the record is being added to the same form that is making the call, you can omit this argument.

The third argument specifies the action that would be performed. This argument holds a constant value. In the case of adding a new record, the value of this argument would be acNewRec.

The last argument has to do with other values of the third argument.

Here is an example that opens a form named Customers at a new record:

Private Sub cmdAddCustomer_Click()
    DoCmd.OpenForm "Customers1"
    DoCmd.GoToRecord acDataForm, "Customers", acNewRec
End Sub

Instead of writing this code, you can use the Command Button Wizard where you would select Record Operations followed by Add New Record.


Practical LearningPractical Learning: Creating a Data Entry Form

  1. Open the GCS2 database you created in the previous lesson
  2. In the Forms section of the Database window, right-click CleaningOrders and click Save As...
  3. In the Save Form To text box, change the name to NewCleaningOrder and click OK
  4. Right-click NewCleaningOrder and click Design View
  5. Double-click the button at the intersection of both rulers the access the Properties window for the form and, in the All tab, change the properties as follows:
    Caption: Georgetown Cleaning Services - New Cleaning Order
    Data Entry: Yes
    Navigation Buttons: No
  6. Switch the form to Form View
  7. Save the form
  8. Click Customer Phone
  9. Type 1026882250 and press Tab
  10. In the Customer Name, type Telanie Marba
  11. Click the arrow of the Date Left and select a data that corresponds to June 12, 2002
  12. Set the Time Left to 10:15 AM
  13. Set the Date Expected by adding 1 day to the date left
  14. Set the Time Expected to 8AM
  15. Click Tax Rate and type 0.0575
  16. Complete the cleaning order with the following values:
    Item Unit Price Qty
    Shirts 1.75 4
    Pants 2.65 2
    Jacket 3.25 1
    Tie 2.25 5
  17. Close the form



Previous Copyright © 2005-2015, FunctionX Next