21
LaGuardia Community College 31-10 Thomson Ave, Long Island City, New York 11101 Created by ISMD’s Dept. Training Team. Microsoft Access 2010 Level III Handout Objectives I. Creating a Password Table II. Designing a Form III. Entering Codes Overview: With its Microsoft Office Fluent user interface and interactive design capabilities that do not require a deep database knowledge, Microsoft Office Access 2010 helps you track and report information with ease. I. Creating a Password Table 1. From the Access File Tab, Click Blank database enter the File name “Company Login Databaseand choose a location for storing the new database, Click Create.

Microsoft Access 2010 Level III - LaGuardia … · LaGuardia Community College 31-10 Thomson Ave, Long Island City, New York 11101 Created by ISMD’s Dept. Training Team. Microsoft

Embed Size (px)

Citation preview

LaGuardia Community College 31-10 Thomson Ave, Long Island City, New York 11101

Created by ISMD’s Dept. Training Team.

Microsoft Access 2010 Level III

Handout Objectives

I. Creating a Password Table

II. Designing a Form

III. Entering Codes

Overview: With its Microsoft Office Fluent user interface and interactive design capabilities that do not

require a deep database knowledge, Microsoft Office Access 2010 helps you track and report

information with ease.

I. Creating a Password Table

1. From the Access File Tab, Click Blank database enter the File name “Company Login

Database” and choose a location for storing the new database, Click Create.

2 | P a g e

2. Go to the Design View and save the table as Tbl_Employees

3. Add the following field names and corresponding Data Types

a. Employee ID – Auto Number

b. EmpName – Text

c. EmpPassword – Text

i. Go to Input Mask – Select Yes to Save

ii. Select Password – Finish

4. Go back to the Datasheet view and – Save.

5. Open the employees Table (Fill in entries) once done close table and Save.

d. Jack Smith - 11111

e. Jane Doe - 22222

f. Mary Cline - 33333

3 | P a g e

II. Designing a Form

1. Go to Create tab and select Form Design from the Forms Group

2. Go to the Design Tab and select Property Sheet from the Tools Group

4 | P a g e

3. In the Property sheet modify the Selection type

Form from in the Format Tab as follows:

a. Allow Datasheet View – No

b. Allow Pivot Table – No

c. Allow Pivot Chart View – No

d. Allow Layout View – No

e. Record Selectors – No

f. Navigation Buttons – No

g. Dividing Lines – Yes

h. Border Style – Dialog

i. Go to the Other tab in the property sheet and modify the Popup to Yes

5 | P a g e

4. Right Click on Form Grid and select Form Header / Footer

5. Increase the Form Header and Decrease the size of Form Footer.

6 | P a g e

6. Right Click in the Form Header and select from Fill/Back Color choose a Light Gray and repeat

the same steps for the Form Footer.

7. Go to the Controls group in the Design tab and select Label and place cursor in Form Heading

7 | P a g e

a. Type: Please Enter Password

b. Go to Format tab and change Font Color to Black

c. Increase the Font Size to 20

d. Right Click on Text go to Size and Select To Fit (Adjust Accordingly to grid)

8. Go to Design Tab and double click Button from the Controls group.

a. Drop and drag the Button in the Form Footer (Cancel the Wizard)

8 | P a g e

b. Copy the Button and paste next to the first button created.

c. Double Click the first button and rename to &Login

i. Select Other tab in Property Sheet

ii. Change Name to cmdLogin

9 | P a g e

d. Double Click the Second button and rename to Exit

i. Select Other tab in Property Sheet

ii. Change Name to CmdExit

9. Go to the Design Tab, click on Combobox from the Controls Group then Drag and

Drop into Detail Section

10 | P a g e

a. Select the First option in the Wizard (I want this com…) click Next

b. Make sure the Tables view option is selected and click Next

c. Click the > to add Employee ID & EmpName to Selected Fields section click Next

11 | P a g e

d. Select Employee Name as Ascending and click Next and Finish.

e. Click in the Unbound Section go to Other tab in Property Sheet and change name to

CboEmployeeName

f. Select the left most box (EmpName) and change font color to Black and Resize Boxes

Accordingly.

12 | P a g e

10. Go to the Design Tab, select Text Box from the Controls Group then drop and drag

into Details section

a. Click in the left text box and type in Password

b. Click in the Unbound Section go to Other tab in Property Sheet and change name to

TxtPassword.

c. Select the left most box (Password) and change font color to Black and Resize Boxes

Accordingly.

13 | P a g e

d. Close the Form (Right Click and Rename to FrmLogin) OR =

=

11. Go to the Create Tab and Select Blank Form Design from the Forms group

a. Select Button from the Controls Group and drop into the center of the Form

and Click Cancel on the Wizard Box

14 | P a g e

b. Increase the Size and Rename Command0 to Welcome and click on design grid.

=

c. Close form and rename as MainForm press Ok

III. Entering Codes

12. Open frmLogin in the design view (Right Click and Select Design View)

15 | P a g e

a. Right click on the Login button and select Build Event….

b. Select Code Builder and OK it.

16 | P a g e

c. Select the Code from the Code Page and Copy the Codes from the Notepad File called

VBfrmlogincode.txt and paste to replace previous code.

Copy This Code

17 | P a g e

Paste Code here to replace then Save (Floppy) and Close (Red X)

d. Right click on the Exit Button Select Build Event

18 | P a g e

e. Select Code Builder and OK it

f. Type in doCmd.Quit in between Private Sub cmdExit_Click() and End Sub

19 | P a g e

g. Save and Test

20 | P a g e

VB CODE copy below and Paste.

Option Compare Database

Private intLogonAttempts As Integer

Private Sub cmdLogin_Click()

'Check to see if data is entered into the UserName combo box

If IsNull(Me.cboEmployeeName) Or Me.cboEmployeeName = "" Then

MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"

Me.cboEmployeeName.SetFocus

Exit Sub

End If

'Check to see if data is entered into the password box

If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then

MsgBox "You must enter a Password.", vbOKOnly, "Required Data"

Me.txtPassword.SetFocus

Exit Sub

End If

'Check value of password in tblEmployees to see if this matches value chosen in combo box

If Me.txtPassword.Value = DLookup("EmpPassword", "tbl_Employees", "[Employee ID]=" &

Me.cboEmployeeName.Value) Then

MyEmpID = Me.cboEmployeeName.Value

'Close logon form and open splash screen

DoCmd.Close acForm, "frmLogin", acSaveNo

DoCmd.OpenForm "MainForm"

Else

MsgBox "Password Invalid. Please Try Again", vbCritical + vbOKOnly, "Invalid Entry!"

Me.txtPassword.SetFocus

21 | P a g e

End If

'If User Enters incorrect password 3 times database will shutdown

intLogonAttempts = intLogonAttempts + 1

If intLogonAttempts > 3 Then

MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical,

"Restricted Access!"

Application.Quit

End If

End Sub

Private Sub FormFooter_Click()

End Sub