0% found this document useful (0 votes)
8 views2 pages

MS Access Cheat Sheet

This document provides a step-by-step guide to creating a mini application in MS Access, including the creation of tables for Students, Courses, and Users, as well as a login form and a dashboard. It includes code snippets for login functionality, a search feature for student records, and instructions for generating reports. The final steps involve setting the display form and customizing the user interface for a cleaner look.

Uploaded by

markleoninform
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

MS Access Cheat Sheet

This document provides a step-by-step guide to creating a mini application in MS Access, including the creation of tables for Students, Courses, and Users, as well as a login form and a dashboard. It includes code snippets for login functionality, a search feature for student records, and instructions for generating reports. The final steps involve setting the display form and customizing the user interface for a cleaner look.

Uploaded by

markleoninform
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MS Access Mini App - Cheat Sheet

Step 1: Create Tables


Create three tables:
1. Students
- StudentID (AutoNumber, PK)
- StudentName (Short Text)
- Gender (Short Text)
- Age (Number)
- PhoneNumber (Short Text)
- CourseID (Number)

2. Courses
- CourseID (AutoNumber, PK)
- CourseName (Short Text)
- Teacher (Short Text)

3. Users
- Username (Short Text)
- Password (Short Text)

Set relationships: CourseID (Courses) -> CourseID (Students)

Step 2: Create Login Form


Create a form 'LoginForm' with:
- Textboxes: txtUsername, txtPassword (Input Mask: Password)
- Button: btnLogin

Code for btnLogin_Click:


------------------------------------------------
Private Sub btnLogin_Click()
Dim uname As String
Dim pword As String
uname = Me.txtUsername
pword = Me.txtPassword
If DCount("*", "Users", "Username='" & uname & "' AND Password='" & pword & "'") > 0 Then
MsgBox "Login successful!", vbInformation
DoCmd.Close acForm, "LoginForm"
DoCmd.OpenForm "Dashboard"
Else
MsgBox "Incorrect username or password!", vbExclamation
End If
End Sub
MS Access Mini App - Cheat Sheet

------------------------------------------------

Step 3: Student Form + Search Box


Create 'StudentForm' from Students table.
- Change Gender to Combo Box, Row Source: "Male";"Female";"Other"

Add txtSearch box + btnSearch button with code:


------------------------------------------------
Private Sub btnSearch_Click()
Me.Filter = "StudentName LIKE '*" & Me.txtSearch & "*'"
Me.FilterOn = True
End Sub
------------------------------------------------

Step 4: Create a Report


Create a report from the Students table.
Save it as 'StudentReport'.

Step 5: Dashboard Form


Create blank form 'Dashboard' with buttons:
1. Open StudentForm
Code: DoCmd.OpenForm "StudentForm"
2. Open StudentReport
Code: DoCmd.OpenReport "StudentReport", acViewPreview
3. Open Courses table
Code: DoCmd.OpenTable "Courses"
4. Log Out
Code: Application.Quit

Step 6: Final Touch


File > Options > Current Database:
- Set Display Form: LoginForm
- Uncheck Navigation Pane for clean UI

You might also like