|
An Order Entry Form
|
|
Introduction
If you create a regular form, every time the user opens it, it starts by displaying the first record. On most order entry
databases, you may want the user to jump straight to an empty record to perform a new order. Microsoft Access provides various solutions to this problem. With most of them, you don't have to write a single line of code.
Practical Learning: Creating an Order Entry Form
- Start a new database named People
- In Design View, create a table with the following fields:
Field Name |
Data Type |
Additional Properties |
GenderID |
AutoNumber |
Primary Key
Caption: Gender ID |
Gender |
Text |
Field Size: 10 |
- Save the table as Genders and switch it to Datasheet View
- Set the first gender to Female and the second to Male
- Close the table
- Create another table in Design View with the following fields:
Field Name |
Data Type |
Additional Properties |
PersonID |
AutoNumber |
Primary Key
Caption: Person ID |
FirstName |
Text |
Field Size: 20
Caption: First Name |
LastName |
Text |
Field Size: 20
Caption: Last Name |
GenderID |
Number |
Field Size: Long Number
Caption: Gender |
- Save the table as Persons and switch it to Datasheet View
- Set the records with some values:
Person ID |
First Name |
Last Name |
Gender |
1 |
Helene |
Watts |
1 |
2 |
Alfred |
Baugh |
2 |
3 |
Mauricette |
Kouma |
1 |
- Close the table
- Use AutoForm to create a form based on the Persons table and switch
the form to Design View
- Delete the GenderID text box (and its accompanying label)
- With the Control Wizard button down in the Toolbox, use the Combo
Box button to start
the Combo Box Wizard using the Genders table as the source of data,
selecting the Gender field and storing it in the GenderID field. Set
the label of the combo box to Gender and click Finish
- Save the form as Persons and design it as you see fit:
- Save the form and close it
An Order Entry Form
To create a new record, the user can just click the New
Record button . You can also
use the Command Button Wizard to create a button that would make this
obvious to the user.
An effective solution in creating an order entry form
consists of making it separate from the main form that displays all
records of the parent table. To do this, you can simply set the Data Entry
property of the form to Yes. There are some other cosmetic actions you can
take to make your order entry form more efficient.
Practical Learning: Creating an Order Entry Form
- In the Database window, click Forms
- To create a copy of the form, right-click the Persons form and click
Save As (if using MS Access 97, it is Save As/Export)
- (If using MS Access 97, click the Within The Current Database As
radio button)
Replace the name of the form with NewPerson and click OK
- In the Database window, right-click the NewPerson form and
click Design View
- Double-click the button at the intersection of both rulers
to display the Properties window.
In the Properties window, click the All tab and change the following properties
Caption: New Person
Data Entry: Yes
Record Selectors: No
Navigation Buttons: No
- Close the Properties window
- Right-click anywhere in the form and click Form Header/Footer
- Now we will allow the user to be able to undo a record
On the Toolbox, make sure the Control button is down
and click the Command Button
- On the form click in the Form Footer section
- When the Command Button Wizard starts, in the first page, in the
Categories list, click Record Operations
- In the Actions list, click Undo Record
- Click Next
- Change the Undo Record text with Reset and click Next
- Change the name of the button to cmdReset and click Finish
- Test and close the form
|