Building the User Interface


Let’s create the empty forms for the user interface. You will then write the code in class modules and standard modules, and finish off by adding code to each form to call the class modules and standard modules.

Try It Out-Building the frmSearch and frmCustomers Forms

image from book

Let’s create the two forms that will be used by the application.

  1. Create a new form called frmSearch. Open the form in Design View. Next, drag the numerous controls onto the form and resize them, as shown in Figure 14-20.

    image from book
    Figure 14-20

  2. The following table will help ensure you have all the correct objects on the form. Rename the controls and change other properties for each object as shown in the following table. If you placed items on the form in a different order than described, your column default names may not match with the exact numbers shown below.

    Open table as spreadsheet

    Default Name on Figure 14-20

    Name

    Type of Control

    Other Properties to Set from the Properties Dialog

    Form1

    frmSearch

    Form

    Record Selectors = No; Navigation Buttons = No; Dividing Lines = No; Auto Center = Yes; Pop up = Yes; Caption = "Customer Search"

    Text0

    txtCustomerNum

    Text Box

    Set corresponding label caption to "Customer Number:"

    Text2

    txtPhone

    Text Box

    Set corresponding label caption to "Phone:"

    Text4

    txtLName

    Text Box

    Set corresponding label caption to "Last Name:"

    Text6

    txtFName

    Text Box

    Set corresponding label caption to "First Name:"

    Text8

    txtCompany

    Text Box

    Set corresponding label caption to "Company:"

    Text10

    txtAddress

    Text Box

    Set corresponding label caption to "Address:"

    Text12

    txtCity

    Text Box

    Set corresponding label caption to "City:"

    Text14

    txtRegion

    Text Box

    Set corresponding label caption to "State / Region:"

    Text16

    txtPostalCode

    Text Box

    Set corresponding label caption to "Postal Code:"

    Command18

    cmdSearch

    Command Button

    Caption = "Search"

    Command19

    cmdClear

    Command Button

    Caption = "Clear"

    List20

    1stResults

    List Box

    Caption = "Search Results"

    Labe122

    1b1SearchInstr

    Label

    Caption = "Please Specify One Or More Search Criteria Below:"

  3. Verify that each control on frmSearch has the correct name and other property settings as listed in the prior tables. If any of these are misspelled, later code referencing will produce an error you will have to fix. After setting all the properties, frmSearch should now appear as shown in Figure 14-21.

    image from book
    Figure 14-21

  4. Make sure to save all the changes made to frmSearch.

  5. Next, create a new form called frmCustomers. Drag the controls onto the form and resize them as shown in Figure 14-22.

    image from book
    Figure 14-22

  6. The following table will help ensure you have all the correct objects on the form. Rename the controls and change other properties for each object as shown in the table. If you placed items on the form in a different order than described, your default names may not match exactly as shown below.

    Open table as spreadsheet

    Default Name (on Figure 14-22)

    Name

    Type of Control

    Other Properties to Set from the Properties Dialog

    Form2

    frmCustomers

    Form

    Record Selectors = No; Navigation Buttons = No; Dividing Lines = No; Auto Center = Yes; Pop up = Yes; Caption = "View / Manage Customer Accounts"

    Text0

    txtCustomerNum

    Text Box

    Set corresponding label caption to "Customer Number:"

    Text2

    txtLName

    Text Box

    Set corresponding label caption to "Last Name:"

    Text4

    txtFName

    Text Box

    Set corresponding label caption to "First Name:"

    Text6

    txtMName

    Text Box

    Set corresponding label caption to "Middle Name:"

    Text8

    txtCompany

    Text Box

    Set corresponding label caption to "Company:"

    Text10

    txtAddress1

    Text Box

    Set corresponding label caption to "Address 1:"

    Text12

    txtAddress2

    Text Box

    Set corresponding label caption to "Address 2:"

    Text14

    txtCity

    Text Box

    Set corresponding label caption to "City:"

    Text16

    txtRegion

    Text Box

    Set corresponding label caption to "State / Region:"

    Text18

    txtPostalCode

    Text Box

    Set corresponding label caption to "Postal Code:"

    Text20

    txtHomePhone

    Text Box

    Set corresponding label caption to "Home Phone:"

    Text22

    txtWorkPhone

    Text Box

    Set corresponding label caption to "Work Phone:"

    Text24

    txtCellPhone

    Text Box

    Set corresponding label caption to "Cell Phone:"

    Text26

    txtEmail

    Text Box

    Set corresponding label caption to "Email:"

    Combo28

    cboPlan

    Combo Box

    Set corresponding label caption to "Plan:"

    List30

    1stPlanHistory

    List Box

    Set corresponding label caption to "Plan History:"

    Command32

    cmdSave

    Command Button

    Caption = "Save"

    Command33

    cmdAddNew

    Command Button

    Caption = "Add New"

    Command34

    cmdMoveFirst

    Command Button

    Caption = "Move First"; Picture = select Go To First 1 from list

    Command35

    cmdMovePrevious

    Command Button

    Caption = "Move Previous"; Picture = select Go To Previous 1 from list

    Command36

    cmdMoveNext

    Command Button

    Caption = "Move Next"; Picture = select Go To Next 1 from list

    Command37

    cmdMoveLast

    Command Button

    Caption = "Move Last"; Picture = select Go To Last 1 from list

  7. After setting all the properties, frmCustomers should now appear as shown in Figure 14-23.

    image from book
    Figure 14-23

  8. Save all the changes made to frmCustomers.

  9. A database window of how the Customer Service Access project should appear at this point is illustrated in Figure 14-24.

    image from book
    Figure 14-24

image from book




Beginning Access 2007 VBA
Beginning Access 2007 VBA
ISBN: 0470046848
EAN: 2147483647
Year: 2004
Pages: 143

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net