Home

The Forms of a Database Application

 

Form Fundamentals

 

Introduction to Form Creation

A visual application such as a computer database usually starts with a rectangular object that hosts other controls. Such an object is a form. In Microsoft Access, you can create a form that stands on its own like the forms of other programming environments, or you can create a form that is tied to a list. This means that the process of creating a form may depend on how you proceed.

To manually create a new form, on the main menu of Microsoft Access, you can click Insert -> Form. This would display the New Form dialog box where you can click Design View and click Ok. If you are already in the Forms section of the Database window, you can double-click the Create Form In Design View link or button. This would directly start the new form in Design View.

To programmatically create a form, call the CreateForm() method of the Application object. The syntax of this method is:

CreateForm([database[, formtemplate]])

The first argument to this method is the name of the database that will receive the form. If the form will be added to the current database, you can omit this argument. The second argument is the name of an existing form that you want to use as template. If you specify this argument, you must make sure that you provide the name of a form. Otherwise, you can omit it.

Here is an example:

Private Sub cmdCreateForm_Click()
    Dim frmEmployees As Form
    
    Set frmEmployees = CreateForm
End Sub
 

Practical Learning Practical Learning: Introducing Forms

  1. Start Microsoft Access and open the GCS1 database you started in Lesson 9
  2. On the Database window, click Forms.
    To create a new form, in the Forms section of the Database window, double-click Create Form in Design View

Naming a Form

When you have just created a form, it displays dully on the screen. Before designing, while designing, or after designing the form, it is a good idea to save it. To do this, you can click the Save button on the Standard toolbar and provide its name. The name of a form follows the rules of objects in Microsoft Access. This means that it can be as bizarre as possible. In our lessons, here are the rules we will use to name our forms:

  • The name will start with a letter, usually in uppercase
  • After the first letter, the name may consist of digits, letters, and underscore
  • The name will not contain special characters
  • In some cases, we will allow empty spaces in a name. In most cases, we will avoid including empty spaces in a name
 

Practical Learning Practical Learning: Naming a Form

  1. To save the form, on the Form Design toolbar, click the Save button
  2. Set the name to Central
     
    Save As
  3. Click OK and close the form
  4. To create another form, on the Form Design toolbar, click the arrow of the New Object button and click Form
  5. In the New Form dialog box, make sure Design View is selected and click OK
  6. To save the form, on the main menu, click File -> Save
  7. Type CleaningOrders as the name of the new form and press Enter
  8. Close the form
 

A Form From a Table

While the table is probably the most appropriate object for you, it may not be convenient to most users. An alternative is to create a form and make it user friendly. Fortunately, Microsoft Access provides fast means of creating a form.

The AutoForm is a feature that allows you to easily generate a form with little to no effort. To use it:

  • In the Tables section of the Database window, first select the table that holds the data. Then, on the Database toolbar, click the arrow of the New Object button and click AutoForm. Normally, by default, when Microsoft Access starts, Autoform is selected already on the New Object button. This means that, after selecting the table, you should be able to simply click the New Object button and a new form would be generated
  • In the same way, if you have already selected a table in the Database window, on the main menu, you can click Insert -> AutoForm and this would generate a new form
  • On the main menu of Microsoft Access, you can click Insert -> Form. In the New Form dialog box, click AutoForm: Columnar. In the combo box, select the table that holds the data, and click OK

After the AutoForm has generated a new form, you are able to enter new information into its Windows controls. You should also save the form if you want to preserve it.

 

Practical LearningPractical Learning: Using AutoForm

  1. On the main menu of Microsoft Access, click Insert -> Form
  2. In the New Form dialog box, click AutoForm: Columnar
  3. In the combo box, select IdentityCards
     
  4. Click OK and notice that a new form is generated
  5. To save the form, click its System Close button
  6. When asked whether you want to save it, click Yes
  7. Accept the suggested name of the form and click OK
 

A Data Access Page From a Table

A Data Access Page is another convenient object that can assist the users of your database. It is web-based object but appears like a form. As done for a form, you can easily create a normal DAP by using a the AutoPage. To do this:

  • On the main menu of Microsoft Access, you can click Insert -> Page. In the New Data Access Page dialog box, click AutoPage: Columnar. In the combo box, select the table that holds the data, and click OK
  • From the Pages section of the Database window, click the New button. In the New Data Access Page dialog box, click AutoPage: Column. In the combo box, select the table that holds the data, and click OK
 

Practical LearningPractical Learning: Using AutoPage

  1. On the main menu of Microsoft Access, click Insert -> Page
  2. In the New Data Access Page dialog box, click AutoPage: Columnar
  3. In the combo box, select Identities
     
  4. Click OK and notice that a new Data Access Page is generated
  5. To save the page, click its System Close button
  6. When asked whether you want to save it, click Yes
  7. Accept the suggested name of the page and click Save
 

Previous Copyright © 2005-2016, FunctionX Next