Microsoft Access from Beginning to End

Microsoft Access Complete Learning Resource | Devine Vision Tech
Devine Vision Tech Learning Centre

Microsoft Access from Beginning to End

A complete, simple-English online book for planning, building, using, securing and maintaining relational databases with Microsoft Access.

39 complete lessonsBeginner to advancedFull college database projectWorks offline

What is data?

Data means raw facts. Examples are a student name, a phone number, a product price, a date of birth or an examination mark.

What is information?

Information is data that has been arranged and explained so that it has meaning. A list of marks is data. A report showing the highest mark, average mark and pass rate is information.

What is a database?

A database is an organised collection of related data. It allows people to store, find, update, calculate, summarise and report information.

What is a DBMS?

A Database Management System, or DBMS, is software used to create and manage databases. Examples include Microsoft Access, Microsoft SQL Server, MySQL, PostgreSQL, Oracle Database and SQLite.

What is Microsoft Access?

Microsoft Access is a relational desktop database program. It is part of some Microsoft 365 and Microsoft Office editions. It can store data in tables and use queries, forms, reports, macros and Visual Basic for Applications to work with that data.

Table

Stores data in rows and columns.

Query

Finds, filters, calculates, joins or changes data.

Form

Provides a friendly screen for entering and viewing data.

Report

Presents data for reading, printing or sharing.

Macro

Automates common actions without writing much code.

Module

Stores VBA procedures for advanced automation.

Common uses of Access

  • Student registration and examination records.
  • Patient, appointment and clinic records for small organisations.
  • Stock, sales, suppliers and purchase records.
  • Employee, attendance and payroll-support records.
  • Library books and borrowing records.
  • Projects, assets, vehicles, members and customers.
Important: Microsoft Access is useful for small and medium database solutions. Large public systems normally need a server database and a web or desktop application.

Start Microsoft Access

  1. Open the Windows Start menu or Search.
  2. Type Access.
  3. Select Microsoft Access.
  4. Choose Blank database, a template or an existing database.
  5. When creating a blank database, type a clear file name and choose a safe folder.
  6. Select Create.

Main parts of the Access window

PartSimple meaning
Title BarShows the name of the current database and Access.
Quick Access ToolbarContains common commands such as Save, Undo and Redo.
File tabOpens Backstage view for New, Open, Save As, Print, Options and account settings.
RibbonContains tabs, groups and commands.
Navigation PaneLists tables, queries, forms, reports, macros and modules.
Object tabShows each open table, query, form, report or code object.
Work areaThe main place where the selected object is opened and edited.
Status BarShows view buttons, record information, filters and other status details.
Search box in Navigation PaneFinds database objects by name.

Important Ribbon tabs

TabMain use
FileCreate, open, save, print, compact, repair and change options.
HomeView, clipboard, sort, filter, records, find and text formatting.
CreateCreate tables, queries, forms, reports, macros and modules.
External DataImport, link and export data.
Database ToolsRelationships, dependencies, analysis, macros, VBA, compact and repair.
Design or FormatAppears when an object is open in a design or layout view.
Views: Datasheet View shows data. Design View changes the structure. Layout View changes form or report layout while showing data. Form View and Report View show the finished object.

Why planning is important

A database can become confusing when tables are created before the real work is understood. Good planning reduces repeated data, wrong relationships and difficult reports.

Questions to ask

  • What problem will the database solve?
  • Who will enter, check and use the data?
  • What facts must be stored?
  • What reports, forms and searches are needed?
  • Which fields must be unique?
  • Which rules must prevent wrong data?
  • Will several people use the database at the same time?
  • How will backups and privacy be managed?

Simple planning example: student registration

NeedDatabase decision
Store each student onceCreate a Students table.
Store programmes onceCreate a Programmes table.
Store subjects onceCreate a Subjects table.
A student can take many subjectsCreate an Enrolments table between Students and Subjects.
Print a student listCreate a query and report.
Enter student details easilyCreate a Student form.
Prevent duplicate student numbersUse a unique indexed field.

Basic design steps

  1. Write the purpose in one sentence.
  2. List the main things you need to store. These are possible entities.
  3. List the facts about each entity. These are possible fields.
  4. Choose a primary key for every table.
  5. Decide how tables are related.
  6. Add validation rules and required fields.
  7. Draw the relationship diagram.
  8. Create a small test database before entering real data.
  9. Test all forms, queries and reports.
  10. Document the finished design.
ConceptMeaningExample
EntityA real thing or subject about which data is stored.Student, employee, product or course.
TableA collection of similar records.Students table.
FieldOne type of fact stored in a column.StudentName.
RecordOne complete item stored in a row.One student.
ValueThe data inside one field for one record.Asha Mrema.
Primary keyA field or fields that uniquely identify each record.StudentID.
Foreign keyA field that points to the primary key in another table.ProgrammeID in Students.
RelationshipA connection between tables.Programme has many students.
IndexA structure that helps Access find and sort records faster.Unique index on RegistrationNumber.
Data integrityRules that keep data correct and consistent.A payment cannot refer to a missing student.

Three common relationship types

  • One-to-one: one record in Table A matches one record in Table B. It is less common.
  • One-to-many: one programme has many students. This is the most common type.
  • Many-to-many: many students take many subjects. This is solved with a junction table such as Enrolments.
Rule: A well-designed table should normally describe one main subject only. Do not mix students, programmes, payments and subjects in one large table.

Main Access file types

ExtensionPurpose
.accdbModern Access database format.
.mdbOlder Access database format.
.accdeCompiled database that prevents users from changing forms, reports and VBA design.
.accdtAccess database template.
.laccdbTemporary locking file created while an ACCDB database is open. Do not treat it as the real database.

Good file habits

  • Use a clear name such as StudentRecords.accdb.
  • Do not use a vague name such as Database1.accdb.
  • Keep development, test and live copies separate.
  • Close Access before copying a database file.
  • Do not place a live multi-user Access database in a normal cloud-synchronised folder unless the design and sync method are proven safe.
  • Create regular dated backups such as StudentRecords_2026-07-26.accdb.

Create a backup copy

  1. Ask users to close the database.
  2. Open the folder that contains the database.
  3. Copy the ACCDB file.
  4. Paste it into a separate backup location.
  5. Add the date to the backup file name.
  6. Open the backup occasionally to confirm that it works.
Never rely on one copy: Keep at least one backup on a different device or approved storage location.

Common Access data types

Data typeUseExample
Short TextNames, codes, phone numbers and short descriptions.STU-001, 0712345678.
Long TextLong notes or comments.Student remarks.
NumberNumbers used in calculations.Quantity, score or age.
Large NumberVery large whole numbers in supported versions.Large external identifiers.
Date/TimeDates and times.26/07/2026 09:30.
CurrencyMoney values with fixed decimal behaviour.$450.00.
AutoNumberAutomatically creates a unique number.StudentID.
Yes/NoTrue or false values.Active, Paid or Approved.
HyperlinkWeb, file or email links.https://example.com.
AttachmentOne or more files attached to a record.Photo or scanned form.
CalculatedA value calculated from other fields in the same table.[Quantity]*[UnitPrice].
Lookup WizardCreates a lookup field; use carefully because it can hide the real stored value.Programme selection list.

Important field properties

PropertyPurpose
Field SizeControls the allowed size or number range.
FormatChanges how a value is displayed without changing the stored value.
Decimal PlacesControls displayed decimals for number or currency fields.
Input MaskGuides how users type data.
CaptionProvides a friendly display label.
Default ValueAutomatically enters a common starting value.
Validation RuleRejects values that break a rule.
Validation TextExplains the error to the user.
RequiredPrevents a field from being left empty.
Allow Zero LengthControls whether an empty text string is allowed.
IndexedImproves searching and can prevent duplicates.

Examples of validation rules

FieldValidation ruleMeaning
MarkBetween 0 And 100Allow marks from 0 to 100 only.
DateOfBirth<=Date()Do not allow a future birth date.
Quantity>=0Do not allow a negative quantity.
GenderIn (“Female”,”Male”)Allow only the listed values.
EmailIs Null Or Like “*@*.*”Allow blank or a simple email pattern.
Choose the smallest correct type: A phone number should usually be Short Text, not Number, because it is not used for arithmetic and may start with zero.

Create a table in Design View

  1. Choose Create → Table Design.
  2. Type the first field name.
  3. Choose its data type.
  4. Add a useful description.
  5. Set field properties in the lower pane.
  6. Repeat for all fields.
  7. Select the field that will be the primary key.
  8. Choose Primary Key.
  9. Save the table with a clear plural name such as Students.
  10. Open Datasheet View and enter test records.

Good field-name practice

  • Use clear names such as StudentID, FirstName and DateOfBirth.
  • Avoid reserved words such as Date, Name and Value.
  • Avoid spaces and special characters when possible. They make SQL and VBA harder to write.
  • Keep a consistent naming style.
  • Do not put several facts in one field. Use FirstName and LastName when they need to be searched separately.

Example Students table

FieldTypeImportant property
StudentIDAutoNumberPrimary key.
RegistrationNumberShort TextRequired; Indexed: Yes (No Duplicates).
FirstNameShort TextRequired.
LastNameShort TextRequired.
DateOfBirthDate/TimeValidation: <=Date().
PhoneNumberShort TextUse an input mask only when all numbers follow one pattern.
ProgrammeIDNumber (Long Integer)Foreign key.
AdmissionDateDate/TimeDefault Value: Date().
ActiveYes/NoDefault Value: Yes.

Primary key

A primary key must uniquely identify each record. It cannot contain a duplicate value and it cannot be Null.

Good primary-key choices

  • AutoNumber key: easy and stable for many Access databases.
  • Natural key: a real value such as a registration number, but only when it is permanent and truly unique.
  • Composite key: two or more fields used together, often in a junction table.

Matching key data types

When a parent table uses an AutoNumber primary key, the related foreign key should normally be a Number field with Field Size set to Long Integer.

Indexes

  • Index fields that are searched, sorted or joined often.
  • Create a unique index when duplicates must not be allowed.
  • Do not index every field. Too many indexes can slow data entry and increase file size.
  • Long Text and Attachment fields are not normal choices for indexing.
FieldRecommended index
StudentIDPrimary key index.
RegistrationNumberYes (No Duplicates).
LastNameYes (Duplicates OK) when searched often.
ProgrammeIDYes (Duplicates OK) because it is used in relationships.
LongNotesNo.

Create a relationship

  1. Close open tables whose structure is being changed.
  2. Choose Database Tools → Relationships.
  3. Add the required tables.
  4. Drag the primary key from the parent table to the matching foreign key in the child table.
  5. Check the fields and relationship type.
  6. Select Enforce Referential Integrity when appropriate.
  7. Choose cascade options only after understanding their effect.
  8. Select Create.
  9. Save the Relationships window.

Referential integrity

Referential integrity prevents orphan records. For example, Access should not allow a student to use a ProgrammeID that does not exist in the Programmes table.

Cascade options

OptionEffectUse with care
Cascade Update Related FieldsChanges matching foreign keys when the parent key changes.AutoNumber keys normally do not change.
Cascade Delete Related RecordsDeletes child records when the parent record is deleted.A single delete can remove many records.

Many-to-many example

Students and Subjects have a many-to-many relationship. Create a junction table named Enrolments with fields such as EnrolmentID, StudentID, SubjectID, AcademicYear and Semester.

Safer delete practice: Before enabling cascade delete, create a backup and confirm that the business really wants related history removed.

What is normalization?

Normalization means arranging data into sensible related tables so that the same fact is not typed again and again.

Why normalize?

  • Reduces repeated data.
  • Prevents different spellings of the same fact.
  • Makes updates safer.
  • Makes relationships clearer.
  • Reduces insert, update and delete problems.

First Normal Form (1NF)

Each field should hold one value, and each record should be unique.

Bad designBetter design
Subjects = “Math, English, Science” in one field.Store one subject per enrolment record.
Phone1, Phone2, Phone3 repeated columns.Use a related StudentPhones table when many numbers must be stored.
A row without a unique key.Add a primary key.

Second Normal Form (2NF)

When a table has a combined key, every non-key field should depend on the whole key, not only one part.

Third Normal Form (3NF)

Each non-key field should describe the table’s main subject, not another non-key field.

Mixed tableBetter tables
Students contains ProgrammeName, ProgrammeDuration and ProgrammeHead.Students stores ProgrammeID. Programmes stores programme details.
Sales contains CustomerName and CustomerPhone in every sale.Sales stores CustomerID. Customers stores customer details.
Simple test: Ask: “Does this field describe the main subject of this table?” If not, it may belong in another table.

Record navigation

The navigation bar at the bottom of a datasheet or form can move to the first, previous, next, last or new record. It also shows the current record number.

Common record tasks

  • Click the New Record button to add a record.
  • Use Tab to move to the next field.
  • Use Shift + Tab to move to the previous field.
  • Use Find to locate a value.
  • Use Replace carefully because it can change many records.
  • Sort ascending or descending.
  • Use Selection Filter, Filter by Form or Advanced Filter.
  • Remove the filter to show all records again.

Safe editing rules

  • Do not edit important live data without a backup.
  • Use forms for normal users instead of giving direct table access.
  • Use validation rules and required fields.
  • Use a Yes/No Active field when history should remain instead of deleting old records.
  • Record who changed sensitive data when auditing is required.
A filter is not a delete: Filtering hides records that do not match. It does not remove them from the database.

Three different actions

ActionMeaning
ImportCopy external data into the Access database.
LinkKeep data in the original source and connect Access to it.
ExportSend Access data to another file or program.

Common sources and destinations

  • Microsoft Excel workbooks.
  • Text and CSV files.
  • Other Access databases.
  • SharePoint lists.
  • ODBC databases such as SQL Server, when drivers and permissions are available.
  • PDF, Word, Excel, text or email output for reports and data.

Before importing Excel or CSV

  1. Give every column a clear heading.
  2. Remove title rows, merged cells and empty columns.
  3. Keep one type of data in each column.
  4. Check dates and leading zeros.
  5. Remove totals from the raw data area.
  6. Decide whether to create a new table or append to an existing table.
  7. Import a small test first.
  8. Check rejected records and data types after import.

Linked table warning

A linked table depends on its source path, connection and permissions. If the source file moves, use Linked Table Manager to repair the link.

What is a query?

A query asks the database a question. It can show selected fields and records, calculate values, summarise data or change data.

Create a select query in Design View

  1. Choose Create → Query Design.
  2. Add the tables or queries that contain the required fields.
  3. Check that the join lines are correct.
  4. Double-click fields to add them to the design grid.
  5. Choose a sort order when needed.
  6. Type criteria under the correct field.
  7. Clear the Show box for helper fields that should not appear.
  8. Choose Run to view the results.
  9. Save the query with a clear name such as qryActiveStudents.

Common criteria examples

NeedCriteria
Active records onlyTrue
Marks of 50 or more>=50
Marks from 50 to 100Between 50 And 100
One programme“Clinical Medicine”
Either of two townsIn (“Mwanza”,”Shinyanga”)
Names beginning with ALike “A*”
Missing valueIs Null
Value entered todayDate()
Dates in the current monthYear([MyDate])=Year(Date()) And Month([MyDate])=Month(Date())

AND and OR

Criteria on the same row use AND. Criteria on different Or rows use OR.

Calculated field

Type a field name, a colon and an expression in a blank query column.

Access expressions
FullName: [FirstName] & " " & [LastName]
TotalCost: [Quantity] * [UnitPrice]
Balance: Nz([AmountDue],0) - Nz([AmountPaid],0)
Age: DateDiff("yyyy",[DateOfBirth],Date()) - IIf(Format(Date(),"mmdd")<Format([DateOfBirth],"mmdd"),1,0)

Totals query

  1. Create a select query.
  2. Add the required fields.
  3. Choose Totals on the Design tab.
  4. Use Group By for category fields.
  5. Use Sum, Average, Count, Min or Max for numeric fields.
  6. Run and check the result.

Parameter query

A parameter query asks the user for a value. Example criteria:

Query criteria
Between [Enter start date:] And [Enter end date:]
[Enter programme name:]

Use Query Parameters to define the expected parameter data type, especially for dates and numbers.

Crosstab query

A crosstab query summarises data in rows and columns. Example: programme names as row headings, academic years as column headings and Count of students as values.

Null values: Use Nz() carefully when a missing value should be treated as zero or empty text. First decide whether the missing value is truly equivalent to zero.

Types of action queries

TypeWhat it does
AppendAdds records to an existing table.
UpdateChanges values in existing records.
DeleteDeletes matching records.
Make-TableCreates a new table from query results.

Safe action-query method

  1. Create a backup.
  2. Build the query first as a Select query.
  3. Run it and confirm exactly which records are selected.
  4. Change it to the required action-query type.
  5. Check the target table and field mappings.
  6. Run the query once.
  7. Check the number of affected records.
  8. Validate the final data.

Examples

  • Append new students imported from Excel into Students.
  • Update Status to “Inactive” for students who completed a programme.
  • Delete temporary import records after verification.
  • Make a snapshot table for a fixed historical report.
Warning: An action query can change or remove many records in seconds. Use a backup and test on a copy first.

Why use a form?

A form gives users a clear screen for entering, viewing and editing data. It can hide technical fields, show helpful labels and control what users can do.

Create a form with Form Wizard

  1. Choose Create → Form Wizard.
  2. Select the table or query.
  3. Move required fields into Selected Fields.
  4. Choose a layout.
  5. Choose a name such as frmStudents.
  6. Finish and test the form.
  7. Open Layout View or Design View to improve it.

Common form controls

ControlUse
Text BoxDisplay or edit text, number, date and calculated values.
LabelShow instructions or field names.
Combo BoxChoose a value from a list or related table.
List BoxShow several choices at once.
Check BoxEnter Yes/No values.
Command ButtonOpen, save, close, search, print or run an action.
SubformShow related child records.
Tab ControlDivide a large form into pages.
ImageShow a logo or picture.
Attachment ControlDisplay or manage attached files.

Useful form properties

  • Record Source
  • Default View
  • Allow Additions, Allow Edits and Allow Deletions
  • Data Entry
  • Filter and Order By
  • Navigation Buttons and Record Selectors
  • Pop Up and Modal
  • On Load, Before Update and After Update events

Subform example

A main Student form can show one student. A subform can show that student’s enrolments. Link Master Fields may be StudentID and Link Child Fields may also be StudentID.

Good user experience: Put fields in the order users work, use clear labels, show required fields, and keep dangerous buttons away from normal navigation.

What is a report?

A report presents data in a controlled layout. It is normally used for viewing, printing, PDF export or formal output.

Create a report

  1. Create and test the query that will provide the report data.
  2. Choose Create → Report Wizard.
  3. Select the required fields.
  4. Choose grouping levels.
  5. Choose sorting and summary options.
  6. Choose a layout and orientation.
  7. Name the report such as rptStudentsByProgramme.
  8. Open Print Preview and check page breaks, margins and totals.

Report sections

SectionUse
Report HeaderAppears once at the beginning.
Page HeaderAppears at the top of each page.
Group HeaderAppears at the start of each group.
DetailRepeats for each record.
Group FooterShows totals or notes for each group.
Page FooterShows page numbers or repeated footer text.
Report FooterAppears once at the end with grand totals.

Useful report expressions

Report control sources
=Count(*)
=Sum([AmountPaid])
=Avg([Mark])
="Page " & [Page] & " of " & [Pages]
=Now()

Labels

Use the Labels wizard to create address labels, product labels or file labels. Test one page before printing many labels.

What is a macro?

A macro is a list of actions that Access performs automatically. It can open forms, apply filters, run queries, show messages, export reports or close objects.

Common macro actions

  • OpenForm
  • OpenReport
  • CloseWindow
  • GoToRecord
  • SearchForRecord
  • ApplyFilter
  • SetValue
  • RunSQL
  • OutputTo
  • MessageBox
  • QuitAccess

Button macro example

  1. Open the form in Design View.
  2. Add a Button control.
  3. Use the Command Button Wizard or create an Embedded Macro.
  4. Choose an action such as OpenReport.
  5. Enter the report name and view.
  6. Save and test the button.

Navigation form

A Navigation Form gives users one main menu for opening forms and reports. Add only the objects normal users need.

Startup options

  • Choose a display form.
  • Set an application title and icon.
  • Hide the Navigation Pane for normal users only after testing.
  • Keep a safe method for developers to open the full database.
  • Use AutoExec macro only when the startup task is necessary.
Security note: Hiding the Navigation Pane is not strong security. Protect the file, folder, data source and user permissions properly.

What is SQL?

SQL means Structured Query Language. Access creates SQL behind Query Design. SQL View helps you read, edit and reuse the statement.

Basic SELECT query

SQL
SELECT StudentID, FirstName, LastName
FROM Students
WHERE Active = True
ORDER BY LastName, FirstName;

Join two tables

SQL
SELECT Students.RegistrationNumber,
       Students.FirstName,
       Students.LastName,
       Programmes.ProgrammeName
FROM Programmes INNER JOIN Students
ON Programmes.ProgrammeID = Students.ProgrammeID;

Totals query

SQL
SELECT ProgrammeID, Count(StudentID) AS NumberOfStudents
FROM Students
GROUP BY ProgrammeID;

Parameter query

SQL
PARAMETERS [Enter programme ID:] Long;
SELECT *
FROM Students
WHERE ProgrammeID = [Enter programme ID:];

Action-query examples

SQL
UPDATE Students
SET Active = False
WHERE CompletionDate Is Not Null;

DELETE FROM TempImports
WHERE ImportStatus = "Rejected";
Access SQL differences: Access SQL is similar to standard SQL, but some functions, wildcards and data-definition details are different. Test statements inside Access.

What is VBA?

Visual Basic for Applications is the programming language built into Access. It is used when macros are not flexible enough.

Main VBA ideas

IdeaMeaning
ModuleA container for VBA code.
Sub procedurePerforms actions but does not return a value.
FunctionReturns a value.
VariableStores a value while code runs.
Event procedureRuns when something happens, such as a button click.
ObjectA form, report, control, recordset or other Access item.
PropertyA setting or value of an object.
MethodAn action an object can perform.

Simple button event

VBA
Private Sub cmdOpenStudents_Click()
    DoCmd.OpenForm "frmStudents"
End Sub

Check a required value

VBA
Private Sub Form_BeforeUpdate(Cancel As Integer)
    If IsNull(Me.RegistrationNumber) Then
        MsgBox "Enter the registration number.", vbExclamation
        Cancel = True
        Me.RegistrationNumber.SetFocus
    End If
End Sub

Simple error handling

VBA
Private Sub cmdPrint_Click()
On Error GoTo HandleError

    DoCmd.OpenReport "rptStudentDetails", acViewPreview, , _
        "StudentID=" & Me.StudentID
    Exit Sub

HandleError:
    MsgBox "The report could not open. " & Err.Description, vbExclamation
End Sub

Good VBA practice

  • Use Option Explicit.
  • Give controls and procedures clear names.
  • Indent code and add short comments.
  • Validate inputs.
  • Handle expected errors.
  • Compile and test before distribution.
  • Do not store passwords or secret keys directly in code.

Access security has several layers

  • Windows and folder permissions: control who can read or change the database file.
  • Database password and encryption: helps protect an ACCDB file.
  • Trusted locations and signatures: control whether macros and VBA can run.
  • Application design: limits forms, commands and data users can see.
  • Server permissions: apply when Access connects to SQL Server or another server database.

Encrypt with a password

  1. Ask all users to close the database.
  2. Open the database using the required exclusive-open method.
  3. Choose File, Info and Encrypt with Password.
  4. Enter a strong password and store it safely.
  5. Test opening the database.
  6. Keep a secure backup.

Privacy rules

  • Collect only data that the work really needs.
  • Do not expose personal or medical data in unnecessary reports.
  • Restrict folders and backups.
  • Remove hidden test data before distribution.
  • Do not email an unprotected database containing confidential information.
  • Set a data-retention rule and delete data safely when legally allowed.
  • Record user actions when accountability is required.
Important: A startup form, hidden Ribbon or ACCDE file can reduce accidental changes, but these features do not replace real access control and encryption.

Why split an Access database?

A split database has two files:

  • Back end: contains shared tables.
  • Front end: contains linked tables, queries, forms, reports, macros and VBA.

Recommended arrangement

  • Place the back end in a secure shared network folder.
  • Give every user a separate local copy of the front end.
  • Do not let all users open one shared front-end file.
  • Use a controlled update method when a new front end is released.
  • Back up the back end regularly.

Split Database Wizard

  1. Create a full backup.
  2. Open the database when no other users are connected.
  3. Choose Database Tools and Access Database under Move Data.
  4. Choose a safe name and location for the back end.
  5. Finish the wizard.
  6. Test forms, queries and reports.
  7. Give each user a local front-end copy.

Record locking

Record locking helps prevent two users from changing the same data at the same time. Choose settings based on the work process and test with real users.

Network rule: A stable local network is much safer for an Access back end than a slow or frequently disconnected connection. For remote or large-scale use, consider a server database.

Why files grow

Access database files can keep unused space after records or objects are changed. Compact and Repair reorganises the file and can reduce its size.

Compact and Repair

  1. Create a backup.
  2. Ask users to close the database.
  3. Open Access.
  4. Choose File, Info and Compact & Repair Database, or use the Database Tools command available in your version.
  5. Wait for the process to finish.
  6. Open and test the database.

Maintenance schedule

TaskSuggested timing
Daily or frequent data backupBased on how much data the organisation can afford to lose.
Test restoreRegularly, not only after a failure.
Compact and RepairAfter major changes or when file growth and performance justify it.
Check broken linksWhen files or servers move.
Review inactive users and permissionsRegularly.
Archive old dataAccording to policy and reporting needs.
Update documentationAfter design or process changes.

Corruption prevention

  • Use reliable hardware, power and network connections.
  • Do not force-close Access during a write operation.
  • Do not edit the back-end file directly over unstable remote connections.
  • Give users separate front ends.
  • Keep enough disk space.
  • Install tested Office updates.

Performance checklist

  • Index fields used often in joins, criteria and sorting.
  • Do not retrieve every field when only a few are needed.
  • Use criteria to reduce records before opening forms and reports.
  • Avoid many domain aggregate functions such as DLookup in repeated detail rows.
  • Use bound forms carefully with very large tables.
  • Store pictures and documents outside the database when attachments make the file too large, while keeping secure paths or IDs.
  • Split multi-user databases.
  • Compact when appropriate.
  • Use pass-through queries or server-side views when working with a server database and large data.
  • Test performance with realistic data volume.

Performance problem example

Slow designImproved design
Form opens every record from a large table.Open only the selected student using a filter or query.
Query uses Like “*word*” on a large unindexed field.Use a better search design or full-text/server search when needed.
Same calculation repeated in many controls.Calculate once in a query or reusable function.
One shared front end for all users.Give each user a local front end.
Many unnecessary indexes.Keep only useful indexes.
QuestionExcelAccess
Main strengthCalculations, analysis, charts and flexible worksheets.Structured related records, forms, queries and reports.
Data structureCells in worksheets.Related tables with keys and rules.
Repeated recordsCan become difficult to control.Designed to manage many similar records.
RelationshipsNot a normal relational database feature.Supports one-to-many relationships and referential integrity.
Data entryFlexible but easier to change structure accidentally.Forms and validation can control entry.
Complex calculationsVery strong worksheet formulas and modelling.Strong queries and expressions, but not a spreadsheet replacement.
Many usersLimited and depends on design and platform.Can support small workgroups when split correctly.
Best choiceBudget, marks analysis, schedules, charts, one-off lists.Student records, inventory, members, transactions, linked data.

Use both programs together

  • Store controlled records in Access.
  • Use queries to prepare clean data.
  • Export or link selected data to Excel for advanced analysis and charts.
  • Return approved cleaned data through a controlled import process.
Simple rule: Use Excel when the main work is calculation and flexible analysis. Use Access when the main work is storing and managing related records.

Test before real use

  • Try valid, invalid, missing and duplicate values.
  • Test every form button.
  • Test reports with no records, one record and many records.
  • Test different user roles.
  • Test simultaneous users when the database is shared.
  • Test backup and restore.
  • Test on the real screen size, printer and network.

Important documentation

DocumentWhat it contains
Purpose statementWhat the database does and does not do.
Data dictionaryTable names, field names, types, meanings and rules.
Relationship diagramHow tables connect.
User guideHow normal users enter, find and report data.
Administrator guideBackups, updates, permissions and troubleshooting.
Change logWhat changed, when and by whom.
Test planExpected results for important functions.
Recovery planHow to restore service after failure.

Data-quality dimensions

  • Accuracy: values are correct.
  • Completeness: required facts are present.
  • Consistency: the same rules are followed everywhere.
  • Timeliness: data is entered and updated at the right time.
  • Uniqueness: duplicate records are controlled.
  • Validity: values follow allowed formats and ranges.

Make forms easier to use

  • Use plain language and meaningful labels.
  • Keep a logical tab order.
  • Use sufficient text size and colour contrast.
  • Do not use colour as the only way to show meaning.
  • Give buttons text labels, not only unclear icons.
  • Place instructions near difficult fields.
  • Write validation messages that tell the user how to fix the problem.
  • Provide keyboard access for frequent actions.
  • Keep layouts consistent across forms.
  • Avoid flashing or unnecessary moving elements.

Helpful validation message

Weak messageBetter message
Invalid.Enter a mark from 0 to 100.
Error 3022.That registration number already exists. Check the number and try again.
Required field.Enter the student surname before saving.
Failed.The report could not open because no student is selected.
ProblemLikely causeAction
Database opens read-onlyFolder permission, file property or another process.Check file and folder permissions; save a local copy if appropriate.
Cannot add a related recordForeign key has no matching parent record.Create or select the correct parent record.
Duplicate value errorUnique index or primary key is being repeated.Find the existing record or correct the value.
Data type mismatchCriteria, join or imported value uses the wrong type.Check field types and parameter types.
Enter Parameter Value appears unexpectedlyMisspelled field or control name.Check query, form and report expressions.
#Name? in a controlControl Source contains an unknown name.Correct the field, function or control reference.
#Error or #Type!Invalid expression or incompatible values.Test each part of the expression and handle Nulls.
Linked table cannot be foundSource moved or connection changed.Use Linked Table Manager.
Record is lockedAnother user is editing the record.Wait, refresh, or review locking settings.
Macros or VBA do not runDatabase is not trusted or content is blocked.Use a trusted location or approved digital-signature process.
Form is slowToo many records, calculations or controls.Use a filtered record source and review indexes.
Database file is very largeDeleted space, attachments or temporary tables.Back up, compact and review storage design.

When an object stops working

  1. Read the exact error message.
  2. Write down what the user did before the error.
  3. Test on a backup or development copy.
  4. Check recent changes.
  5. Check table fields, relationships and query sources.
  6. Compile VBA and check missing references.
  7. Compact and Repair only after creating a backup.
  8. Restore a known good copy when repair is not safe or successful.

Project purpose

Create a database named CollegeStudentSystem.accdb. It will register programmes, students, subjects, enrolments, marks and payments.

Required objects

Object typeObjects
TablesProgrammes, Students, Subjects, Enrolments, Marks, Payments.
QueriesActive students, students by programme, mark results, balances, totals.
FormsMain menu, programme form, student form with enrolment subform, marks form, payment form.
ReportsStudent list, results report, payment balance report, programme summary.
AutomationMain menu buttons, print-current-student button, simple validation macro or VBA.
ManagementRelationships, backup, compact, user guide and test checklist.

Suggested work order

  1. Create a new blank database.
  2. Create all tables in Design View.
  3. Set primary keys, data types and validation.
  4. Create relationships and enforce referential integrity.
  5. Enter a small set of test data.
  6. Create and test queries.
  7. Create forms and subforms.
  8. Create reports.
  9. Create the main navigation form.
  10. Test invalid data and all buttons.
  11. Create a backup and documentation.

Programmes

FieldTypeRule
ProgrammeIDAutoNumberPrimary key.
ProgrammeCodeShort TextRequired; unique.
ProgrammeNameShort TextRequired.
DurationYearsNumberBetween 1 And 10.
ActiveYes/NoDefault Yes.

Students

FieldTypeRule
StudentIDAutoNumberPrimary key.
RegistrationNumberShort TextRequired; unique.
FirstNameShort TextRequired.
LastNameShort TextRequired.
GenderShort TextIn (“Female”,”Male”).
DateOfBirthDate/Time<=Date().
PhoneNumberShort TextOptional or required according to policy.
ProgrammeIDNumber / Long IntegerForeign key.
AdmissionDateDate/TimeDefault Date().
ActiveYes/NoDefault Yes.

Subjects

FieldTypeRule
SubjectIDAutoNumberPrimary key.
SubjectCodeShort TextRequired; unique.
SubjectNameShort TextRequired.
CreditNumber>0.
ProgrammeIDNumber / Long IntegerForeign key.
SemesterNumberBetween 1 And 2.

Enrolments

FieldTypeRule
EnrolmentIDAutoNumberPrimary key.
StudentIDNumber / Long IntegerForeign key.
SubjectIDNumber / Long IntegerForeign key.
AcademicYearShort TextExample: 2026/2027.
SemesterNumberBetween 1 And 2.
EnrolmentDateDate/TimeDefault Date().

Create a unique multi-field index on StudentID, SubjectID, AcademicYear and Semester to prevent duplicate enrolment.

Marks

FieldTypeRule
MarkIDAutoNumberPrimary key.
EnrolmentIDNumber / Long IntegerForeign key; unique when only one final mark is stored.
CourseworkMarkNumberBetween 0 And 40.
FinalExamMarkNumberBetween 0 And 60.
DateEnteredDate/TimeDefault Now().

Payments

FieldTypeRule
PaymentIDAutoNumberPrimary key.
StudentIDNumber / Long IntegerForeign key.
PaymentDateDate/TimeDefault Date().
AmountPaidCurrency>0.
ReceiptNumberShort TextRequired; unique.
PaymentMethodShort TextCash, Bank, Mobile or another approved method.
NotesLong TextOptional.
Parent tableChild tableConnection
ProgrammesStudentsProgrammeID to ProgrammeID.
ProgrammesSubjectsProgrammeID to ProgrammeID.
StudentsEnrolmentsStudentID to StudentID.
SubjectsEnrolmentsSubjectID to SubjectID.
EnrolmentsMarksEnrolmentID to EnrolmentID.
StudentsPaymentsStudentID to StudentID.

Relationship test

  • Try to add a student with a ProgrammeID that does not exist. Access should reject it.
  • Try to add an enrolment for a missing student. Access should reject it.
  • Try to enter the same student-subject-year-semester enrolment twice. The unique index should reject it.
  • Decide whether deleting a student should ever delete payments or marks. In most real systems, historical records should be retained.

1. Active students with programme name

SQL
SELECT Students.StudentID, Students.RegistrationNumber,
       Students.FirstName, Students.LastName,
       Programmes.ProgrammeName
FROM Programmes INNER JOIN Students
ON Programmes.ProgrammeID = Students.ProgrammeID
WHERE Students.Active = True
ORDER BY Students.LastName, Students.FirstName;

2. Final result query

SQL
SELECT Enrolments.EnrolmentID, Students.RegistrationNumber,
       Subjects.SubjectCode, Subjects.SubjectName,
       Nz([CourseworkMark],0)+Nz([FinalExamMark],0) AS TotalMark,
       IIf([TotalMark]>=50,"Pass","Fail") AS Result
FROM ((Students INNER JOIN Enrolments
ON Students.StudentID = Enrolments.StudentID)
INNER JOIN Subjects
ON Enrolments.SubjectID = Subjects.SubjectID)
LEFT JOIN Marks
ON Enrolments.EnrolmentID = Marks.EnrolmentID;

3. Total payments by student

SQL
SELECT StudentID, Sum(AmountPaid) AS TotalPaid
FROM Payments
GROUP BY StudentID;

4. Student fee balance

Assume the required fee is stored in Programmes as ProgrammeFee. Join Students, Programmes and the total-payments query.

Calculated field
Balance: [ProgrammeFee] - Nz([TotalPaid],0)

5. Parameter query by programme

SQL
PARAMETERS [Enter programme code:] Text ( 20 );
SELECT Students.RegistrationNumber, Students.FirstName, Students.LastName
FROM Programmes INNER JOIN Students
ON Programmes.ProgrammeID = Students.ProgrammeID
WHERE Programmes.ProgrammeCode = [Enter programme code:];

frmMainMenu

  • Buttons to open Students, Programmes, Subjects, Marks and Payments.
  • Buttons to preview reports.
  • A button to close the application.
  • A clear title and simple instructions.

frmStudents

  • Record Source: Students or a suitable student query.
  • Use a combo box for ProgrammeID. Store the ID but display ProgrammeCode and ProgrammeName.
  • Add a search box for registration number or name.
  • Add a subform for Enrolments linked by StudentID.
  • Add a button to preview the current student’s details.

frmPayments

  • Use a combo box to select a student.
  • Default PaymentDate to today’s date.
  • Validate AmountPaid as greater than zero.
  • Prevent duplicate receipt numbers.
  • Show the student’s current total paid and balance in calculated controls or a subform.

Form test

  1. Open the form and add a valid record.
  2. Try leaving required fields empty.
  3. Try entering an invalid date or mark.
  4. Try entering a duplicate registration number.
  5. Try selecting a related value.
  6. Test all buttons and tab order.
  7. Close and reopen the form to confirm saved data.

rptStudentsByProgramme

  • Record Source: active students with programme query.
  • Group by ProgrammeName.
  • Sort by LastName and FirstName.
  • Show Count of students in the programme footer.
  • Show page numbers in the page footer.

rptStudentResults

  • Show registration number, student name, subject, coursework, examination, total and result.
  • Group by student.
  • Use clear labels and mark ranges.
  • Do not hide missing marks; show them clearly for checking.

rptPaymentBalances

  • Show fee required, total paid and balance.
  • Use Currency format.
  • Filter or group students with outstanding balances.
  • Show a report total for all outstanding balances.

Print-quality checklist

  • Correct title and reporting period.
  • Organisation name where required.
  • No cut-off fields.
  • Correct page orientation and margins.
  • Repeated page headings.
  • Correct totals.
  • No confidential data that the audience should not see.
Ctrl + NCreate a new database in supported contexts.
Ctrl + OOpen a database.
Ctrl + SSave the current object.
Ctrl + PPrint.
Ctrl + FFind.
Ctrl + HFind and replace.
Ctrl + CCopy.
Ctrl + XCut.
Ctrl + VPaste.
Ctrl + ZUndo when available.
Ctrl + YRedo when available.
Ctrl + ;Insert the current date.
Ctrl + Shift + :Insert the current time.
Ctrl + 'Copy the value from the same field in the previous record.
Ctrl + +Add a new record in many datasheet or form contexts.
Ctrl + -Delete the current record after confirmation.
F2Switch between edit mode and navigation mode in a field.
F4Open or close a property sheet in Design View.
F5Move to the record-number box in Datasheet or Form View.
F6Move between panes.
F11Show or hide the Navigation Pane.
Shift + F2Open the Zoom box for a field or expression.
Alt + F11Open the VBA editor.
EscCancel the current entry or close a menu.

Some shortcuts depend on the Access version, current view and keyboard layout.

Exercise 1: Small contacts database

  1. Create a Contacts table with ContactID, FullName, PhoneNumber, Email, Town and Active.
  2. Set ContactID as AutoNumber primary key.
  3. Prevent duplicate phone numbers.
  4. Create a form for data entry.
  5. Create a query for active contacts in one selected town.
  6. Create a report sorted by name.

Exercise 2: Shop inventory

  1. Create Categories, Products, Suppliers and StockTransactions tables.
  2. Create relationships.
  3. Create a query to calculate stock in minus stock out.
  4. Create a low-stock query.
  5. Create a product form and transaction subform.
  6. Create a stock-value report.

Exercise 3: Library system

  1. Create Members, Books, BookCopies and Loans tables.
  2. Prevent one physical copy from having two open loans.
  3. Create a query for overdue books using Date() and DueDate.
  4. Create a loan form.
  5. Create overdue and borrowing-history reports.

Exercise 4: Advanced automation

  1. Create a split database.
  2. Create a local front-end copy.
  3. Create a startup menu.
  4. Add a button that exports a report to PDF.
  5. Add error handling.
  6. Create a backup and restore test.

Questions

  1. What is a database?
  2. What is the difference between a field and a record?
  3. Why does every table need a primary key?
  4. What is a foreign key?
  5. What does referential integrity do?
  6. What is the difference between a form and a report?
  7. What is a select query?
  8. Name four action-query types.
  9. Why should an action query be tested as a select query first?
  10. Why is a database split for many users?
  11. What is normalization?
  12. What is the difference between importing and linking?
  13. What does Compact and Repair do?
  14. Why should users have separate local front ends?
  15. When is Excel more suitable than Access?

Answer guide

  1. An organised collection of related data.
  2. A field is one type of fact; a record is one complete row about one item.
  3. It uniquely identifies every record and supports relationships.
  4. A field that stores the primary-key value from another table.
  5. It prevents invalid relationships and orphan records.
  6. A form is mainly for data entry and viewing; a report is mainly for formatted output.
  7. A query that displays selected data without changing the stored records.
  8. Append, Update, Delete and Make-Table.
  9. To confirm exactly which records will be changed.
  10. To separate shared tables from user-interface objects and improve multi-user reliability.
  11. Arranging data into sensible related tables to reduce repetition and update problems.
  12. Import copies data; linking keeps data in the external source.
  13. It reorganises the database file, can reduce file size and may repair minor problems.
  14. To avoid sharing one front-end file and to improve reliability and speed.
  15. When the main work is flexible calculations, modelling, charts or worksheet analysis.
TermSimple meaning
ACCDBModern Microsoft Access database file.
Action queryA query that changes data or creates a table.
AutoNumberA field that automatically creates a unique number.
Back endThe shared file that contains tables in a split database.
Bound controlA form or report control connected to a field.
CaptionA friendly label shown instead of the field name.
Combo boxA control for selecting or typing a value.
ControlAn item on a form or report, such as a text box or button.
Control SourceThe field or expression used by a control.
Crosstab queryA summary query with row and column headings.
Data dictionaryDocumentation of tables, fields, types and rules.
Datasheet ViewA row-and-column view of data.
DBMSSoftware used to manage databases.
Design ViewA view used to change object structure.
EntityA subject about which data is stored.
ExpressionA formula used to calculate or evaluate a value.
FieldA column storing one type of fact.
FilterA temporary way to show matching records.
Foreign keyA field that refers to another table’s primary key.
FormAn interface for entering and viewing data.
Front endThe user file containing links, queries, forms, reports and code.
IndexA structure that helps searching and sorting.
JoinA connection used by a query to combine records.
Junction tableA table that resolves a many-to-many relationship.
Lookup fieldA field that presents values from a list or related table.
MacroA set of Access automation actions.
ModuleA container for VBA code.
Navigation PaneThe area that lists database objects.
NormalizationOrganising data to reduce repetition and problems.
NullNo stored value; it is not the same as zero or an empty string.
ObjectA table, query, form, report, macro or module.
ODBCA standard connection method for many external databases.
Parameter queryA query that asks the user for a value.
Primary keyA unique identifier for each record.
QueryA saved question or data operation.
RecordA row containing one complete item.
Record SourceThe table or query that provides data to a form or report.
Referential integrityRules that keep related records valid.
RelationshipA connection between tables.
ReportFormatted output for viewing, printing or sharing.
SQLThe language used to query and manage data.
SubformA form inside another form, usually for related records.
TableAn object that stores records in fields.
Validation ruleA rule that rejects invalid data.
VBAThe programming language used for advanced Access automation.
WildcardA symbol used in pattern matching, such as * in Access Like criteria.
Final lesson: A good database is not only one that opens. It stores correct data, protects users, answers real questions and can be maintained safely.
No matching content was found in this tab. Try another word or choose another tab.

Use this page as a complete Microsoft Access book

The page is self-contained. It can be opened offline, uploaded to a website, pasted into WordPress, printed, or saved as PDF from the browser.

Microsoft Access Complete Learning Resource · Devine Vision Tech
App
Download DiplomaNet App, soma notes bila mtandao!
Scroll to Top