Microsoft Access from Beginning to End
A complete, simple-English online book for planning, building, using, securing and maintaining relational databases with Microsoft Access.
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.
Start Microsoft Access
- Open the Windows Start menu or Search.
- Type Access.
- Select Microsoft Access.
- Choose Blank database, a template or an existing database.
- When creating a blank database, type a clear file name and choose a safe folder.
- Select Create.
Main parts of the Access window
| Part | Simple meaning |
|---|---|
| Title Bar | Shows the name of the current database and Access. |
| Quick Access Toolbar | Contains common commands such as Save, Undo and Redo. |
| File tab | Opens Backstage view for New, Open, Save As, Print, Options and account settings. |
| Ribbon | Contains tabs, groups and commands. |
| Navigation Pane | Lists tables, queries, forms, reports, macros and modules. |
| Object tab | Shows each open table, query, form, report or code object. |
| Work area | The main place where the selected object is opened and edited. |
| Status Bar | Shows view buttons, record information, filters and other status details. |
| Search box in Navigation Pane | Finds database objects by name. |
Important Ribbon tabs
| Tab | Main use |
|---|---|
| File | Create, open, save, print, compact, repair and change options. |
| Home | View, clipboard, sort, filter, records, find and text formatting. |
| Create | Create tables, queries, forms, reports, macros and modules. |
| External Data | Import, link and export data. |
| Database Tools | Relationships, dependencies, analysis, macros, VBA, compact and repair. |
| Design or Format | Appears when an object is open in a design or layout view. |
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
| Need | Database decision |
|---|---|
| Store each student once | Create a Students table. |
| Store programmes once | Create a Programmes table. |
| Store subjects once | Create a Subjects table. |
| A student can take many subjects | Create an Enrolments table between Students and Subjects. |
| Print a student list | Create a query and report. |
| Enter student details easily | Create a Student form. |
| Prevent duplicate student numbers | Use a unique indexed field. |
Basic design steps
- Write the purpose in one sentence.
- List the main things you need to store. These are possible entities.
- List the facts about each entity. These are possible fields.
- Choose a primary key for every table.
- Decide how tables are related.
- Add validation rules and required fields.
- Draw the relationship diagram.
- Create a small test database before entering real data.
- Test all forms, queries and reports.
- Document the finished design.
| Concept | Meaning | Example |
|---|---|---|
| Entity | A real thing or subject about which data is stored. | Student, employee, product or course. |
| Table | A collection of similar records. | Students table. |
| Field | One type of fact stored in a column. | StudentName. |
| Record | One complete item stored in a row. | One student. |
| Value | The data inside one field for one record. | Asha Mrema. |
| Primary key | A field or fields that uniquely identify each record. | StudentID. |
| Foreign key | A field that points to the primary key in another table. | ProgrammeID in Students. |
| Relationship | A connection between tables. | Programme has many students. |
| Index | A structure that helps Access find and sort records faster. | Unique index on RegistrationNumber. |
| Data integrity | Rules 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.
Main Access file types
| Extension | Purpose |
|---|---|
| .accdb | Modern Access database format. |
| .mdb | Older Access database format. |
| .accde | Compiled database that prevents users from changing forms, reports and VBA design. |
| .accdt | Access database template. |
| .laccdb | Temporary 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
- Ask users to close the database.
- Open the folder that contains the database.
- Copy the ACCDB file.
- Paste it into a separate backup location.
- Add the date to the backup file name.
- Open the backup occasionally to confirm that it works.
Common Access data types
| Data type | Use | Example |
|---|---|---|
| Short Text | Names, codes, phone numbers and short descriptions. | STU-001, 0712345678. |
| Long Text | Long notes or comments. | Student remarks. |
| Number | Numbers used in calculations. | Quantity, score or age. |
| Large Number | Very large whole numbers in supported versions. | Large external identifiers. |
| Date/Time | Dates and times. | 26/07/2026 09:30. |
| Currency | Money values with fixed decimal behaviour. | $450.00. |
| AutoNumber | Automatically creates a unique number. | StudentID. |
| Yes/No | True or false values. | Active, Paid or Approved. |
| Hyperlink | Web, file or email links. | https://example.com. |
| Attachment | One or more files attached to a record. | Photo or scanned form. |
| Calculated | A value calculated from other fields in the same table. | [Quantity]*[UnitPrice]. |
| Lookup Wizard | Creates a lookup field; use carefully because it can hide the real stored value. | Programme selection list. |
Important field properties
| Property | Purpose |
|---|---|
| Field Size | Controls the allowed size or number range. |
| Format | Changes how a value is displayed without changing the stored value. |
| Decimal Places | Controls displayed decimals for number or currency fields. |
| Input Mask | Guides how users type data. |
| Caption | Provides a friendly display label. |
| Default Value | Automatically enters a common starting value. |
| Validation Rule | Rejects values that break a rule. |
| Validation Text | Explains the error to the user. |
| Required | Prevents a field from being left empty. |
| Allow Zero Length | Controls whether an empty text string is allowed. |
| Indexed | Improves searching and can prevent duplicates. |
Examples of validation rules
| Field | Validation rule | Meaning |
|---|---|---|
| Mark | Between 0 And 100 | Allow marks from 0 to 100 only. |
| DateOfBirth | <=Date() | Do not allow a future birth date. |
| Quantity | >=0 | Do not allow a negative quantity. |
| Gender | In (“Female”,”Male”) | Allow only the listed values. |
| Is Null Or Like “*@*.*” | Allow blank or a simple email pattern. |
Create a table in Design View
- Choose Create → Table Design.
- Type the first field name.
- Choose its data type.
- Add a useful description.
- Set field properties in the lower pane.
- Repeat for all fields.
- Select the field that will be the primary key.
- Choose Primary Key.
- Save the table with a clear plural name such as Students.
- Open Datasheet View and enter test records.
Good field-name practice
- Use clear names such as
StudentID,FirstNameandDateOfBirth. - Avoid reserved words such as
Date,NameandValue. - 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
| Field | Type | Important property |
|---|---|---|
| StudentID | AutoNumber | Primary key. |
| RegistrationNumber | Short Text | Required; Indexed: Yes (No Duplicates). |
| FirstName | Short Text | Required. |
| LastName | Short Text | Required. |
| DateOfBirth | Date/Time | Validation: <=Date(). |
| PhoneNumber | Short Text | Use an input mask only when all numbers follow one pattern. |
| ProgrammeID | Number (Long Integer) | Foreign key. |
| AdmissionDate | Date/Time | Default Value: Date(). |
| Active | Yes/No | Default 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.
| Field | Recommended index |
|---|---|
| StudentID | Primary key index. |
| RegistrationNumber | Yes (No Duplicates). |
| LastName | Yes (Duplicates OK) when searched often. |
| ProgrammeID | Yes (Duplicates OK) because it is used in relationships. |
| LongNotes | No. |
Create a relationship
- Close open tables whose structure is being changed.
- Choose Database Tools → Relationships.
- Add the required tables.
- Drag the primary key from the parent table to the matching foreign key in the child table.
- Check the fields and relationship type.
- Select Enforce Referential Integrity when appropriate.
- Choose cascade options only after understanding their effect.
- Select Create.
- 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
| Option | Effect | Use with care |
|---|---|---|
| Cascade Update Related Fields | Changes matching foreign keys when the parent key changes. | AutoNumber keys normally do not change. |
| Cascade Delete Related Records | Deletes 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.
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 design | Better 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 table | Better 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. |
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.
Three different actions
| Action | Meaning |
|---|---|
| Import | Copy external data into the Access database. |
| Link | Keep data in the original source and connect Access to it. |
| Export | Send 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
- Give every column a clear heading.
- Remove title rows, merged cells and empty columns.
- Keep one type of data in each column.
- Check dates and leading zeros.
- Remove totals from the raw data area.
- Decide whether to create a new table or append to an existing table.
- Import a small test first.
- 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
- Choose Create → Query Design.
- Add the tables or queries that contain the required fields.
- Check that the join lines are correct.
- Double-click fields to add them to the design grid.
- Choose a sort order when needed.
- Type criteria under the correct field.
- Clear the Show box for helper fields that should not appear.
- Choose Run to view the results.
- Save the query with a clear name such as qryActiveStudents.
Common criteria examples
| Need | Criteria |
|---|---|
| Active records only | True |
| Marks of 50 or more | >=50 |
| Marks from 50 to 100 | Between 50 And 100 |
| One programme | “Clinical Medicine” |
| Either of two towns | In (“Mwanza”,”Shinyanga”) |
| Names beginning with A | Like “A*” |
| Missing value | Is Null |
| Value entered today | Date() |
| Dates in the current month | Year([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.
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
- Create a select query.
- Add the required fields.
- Choose Totals on the Design tab.
- Use Group By for category fields.
- Use Sum, Average, Count, Min or Max for numeric fields.
- Run and check the result.
Parameter query
A parameter query asks the user for a value. Example 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.
Types of action queries
| Type | What it does |
|---|---|
| Append | Adds records to an existing table. |
| Update | Changes values in existing records. |
| Delete | Deletes matching records. |
| Make-Table | Creates a new table from query results. |
Safe action-query method
- Create a backup.
- Build the query first as a Select query.
- Run it and confirm exactly which records are selected.
- Change it to the required action-query type.
- Check the target table and field mappings.
- Run the query once.
- Check the number of affected records.
- 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.
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
- Choose Create → Form Wizard.
- Select the table or query.
- Move required fields into Selected Fields.
- Choose a layout.
- Choose a name such as frmStudents.
- Finish and test the form.
- Open Layout View or Design View to improve it.
Common form controls
| Control | Use |
|---|---|
| Text Box | Display or edit text, number, date and calculated values. |
| Label | Show instructions or field names. |
| Combo Box | Choose a value from a list or related table. |
| List Box | Show several choices at once. |
| Check Box | Enter Yes/No values. |
| Command Button | Open, save, close, search, print or run an action. |
| Subform | Show related child records. |
| Tab Control | Divide a large form into pages. |
| Image | Show a logo or picture. |
| Attachment Control | Display 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.
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
- Create and test the query that will provide the report data.
- Choose Create → Report Wizard.
- Select the required fields.
- Choose grouping levels.
- Choose sorting and summary options.
- Choose a layout and orientation.
- Name the report such as rptStudentsByProgramme.
- Open Print Preview and check page breaks, margins and totals.
Report sections
| Section | Use |
|---|---|
| Report Header | Appears once at the beginning. |
| Page Header | Appears at the top of each page. |
| Group Header | Appears at the start of each group. |
| Detail | Repeats for each record. |
| Group Footer | Shows totals or notes for each group. |
| Page Footer | Shows page numbers or repeated footer text. |
| Report Footer | Appears once at the end with grand totals. |
Useful report expressions
=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
- Open the form in Design View.
- Add a Button control.
- Use the Command Button Wizard or create an Embedded Macro.
- Choose an action such as OpenReport.
- Enter the report name and view.
- 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.
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
SELECT StudentID, FirstName, LastName
FROM Students
WHERE Active = True
ORDER BY LastName, FirstName;Join two tables
SELECT Students.RegistrationNumber,
Students.FirstName,
Students.LastName,
Programmes.ProgrammeName
FROM Programmes INNER JOIN Students
ON Programmes.ProgrammeID = Students.ProgrammeID;Totals query
SELECT ProgrammeID, Count(StudentID) AS NumberOfStudents
FROM Students
GROUP BY ProgrammeID;Parameter query
PARAMETERS [Enter programme ID:] Long;
SELECT *
FROM Students
WHERE ProgrammeID = [Enter programme ID:];Action-query examples
UPDATE Students
SET Active = False
WHERE CompletionDate Is Not Null;
DELETE FROM TempImports
WHERE ImportStatus = "Rejected";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
| Idea | Meaning |
|---|---|
| Module | A container for VBA code. |
| Sub procedure | Performs actions but does not return a value. |
| Function | Returns a value. |
| Variable | Stores a value while code runs. |
| Event procedure | Runs when something happens, such as a button click. |
| Object | A form, report, control, recordset or other Access item. |
| Property | A setting or value of an object. |
| Method | An action an object can perform. |
Simple button event
Private Sub cmdOpenStudents_Click()
DoCmd.OpenForm "frmStudents"
End SubCheck a required value
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 SubSimple error handling
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 SubGood 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
- Ask all users to close the database.
- Open the database using the required exclusive-open method.
- Choose File, Info and Encrypt with Password.
- Enter a strong password and store it safely.
- Test opening the database.
- 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.
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
- Create a full backup.
- Open the database when no other users are connected.
- Choose Database Tools and Access Database under Move Data.
- Choose a safe name and location for the back end.
- Finish the wizard.
- Test forms, queries and reports.
- 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.
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
- Create a backup.
- Ask users to close the database.
- Open Access.
- Choose File, Info and Compact & Repair Database, or use the Database Tools command available in your version.
- Wait for the process to finish.
- Open and test the database.
Maintenance schedule
| Task | Suggested timing |
|---|---|
| Daily or frequent data backup | Based on how much data the organisation can afford to lose. |
| Test restore | Regularly, not only after a failure. |
| Compact and Repair | After major changes or when file growth and performance justify it. |
| Check broken links | When files or servers move. |
| Review inactive users and permissions | Regularly. |
| Archive old data | According to policy and reporting needs. |
| Update documentation | After 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 design | Improved 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. |
| Question | Excel | Access |
|---|---|---|
| Main strength | Calculations, analysis, charts and flexible worksheets. | Structured related records, forms, queries and reports. |
| Data structure | Cells in worksheets. | Related tables with keys and rules. |
| Repeated records | Can become difficult to control. | Designed to manage many similar records. |
| Relationships | Not a normal relational database feature. | Supports one-to-many relationships and referential integrity. |
| Data entry | Flexible but easier to change structure accidentally. | Forms and validation can control entry. |
| Complex calculations | Very strong worksheet formulas and modelling. | Strong queries and expressions, but not a spreadsheet replacement. |
| Many users | Limited and depends on design and platform. | Can support small workgroups when split correctly. |
| Best choice | Budget, 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.
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
| Document | What it contains |
|---|---|
| Purpose statement | What the database does and does not do. |
| Data dictionary | Table names, field names, types, meanings and rules. |
| Relationship diagram | How tables connect. |
| User guide | How normal users enter, find and report data. |
| Administrator guide | Backups, updates, permissions and troubleshooting. |
| Change log | What changed, when and by whom. |
| Test plan | Expected results for important functions. |
| Recovery plan | How 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 message | Better 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. |
| Problem | Likely cause | Action |
|---|---|---|
| Database opens read-only | Folder permission, file property or another process. | Check file and folder permissions; save a local copy if appropriate. |
| Cannot add a related record | Foreign key has no matching parent record. | Create or select the correct parent record. |
| Duplicate value error | Unique index or primary key is being repeated. | Find the existing record or correct the value. |
| Data type mismatch | Criteria, join or imported value uses the wrong type. | Check field types and parameter types. |
| Enter Parameter Value appears unexpectedly | Misspelled field or control name. | Check query, form and report expressions. |
| #Name? in a control | Control 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 found | Source moved or connection changed. | Use Linked Table Manager. |
| Record is locked | Another user is editing the record. | Wait, refresh, or review locking settings. |
| Macros or VBA do not run | Database is not trusted or content is blocked. | Use a trusted location or approved digital-signature process. |
| Form is slow | Too many records, calculations or controls. | Use a filtered record source and review indexes. |
| Database file is very large | Deleted space, attachments or temporary tables. | Back up, compact and review storage design. |
When an object stops working
- Read the exact error message.
- Write down what the user did before the error.
- Test on a backup or development copy.
- Check recent changes.
- Check table fields, relationships and query sources.
- Compile VBA and check missing references.
- Compact and Repair only after creating a backup.
- 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 type | Objects |
|---|---|
| Tables | Programmes, Students, Subjects, Enrolments, Marks, Payments. |
| Queries | Active students, students by programme, mark results, balances, totals. |
| Forms | Main menu, programme form, student form with enrolment subform, marks form, payment form. |
| Reports | Student list, results report, payment balance report, programme summary. |
| Automation | Main menu buttons, print-current-student button, simple validation macro or VBA. |
| Management | Relationships, backup, compact, user guide and test checklist. |
Suggested work order
- Create a new blank database.
- Create all tables in Design View.
- Set primary keys, data types and validation.
- Create relationships and enforce referential integrity.
- Enter a small set of test data.
- Create and test queries.
- Create forms and subforms.
- Create reports.
- Create the main navigation form.
- Test invalid data and all buttons.
- Create a backup and documentation.
Programmes
| Field | Type | Rule |
|---|---|---|
| ProgrammeID | AutoNumber | Primary key. |
| ProgrammeCode | Short Text | Required; unique. |
| ProgrammeName | Short Text | Required. |
| DurationYears | Number | Between 1 And 10. |
| Active | Yes/No | Default Yes. |
Students
| Field | Type | Rule |
|---|---|---|
| StudentID | AutoNumber | Primary key. |
| RegistrationNumber | Short Text | Required; unique. |
| FirstName | Short Text | Required. |
| LastName | Short Text | Required. |
| Gender | Short Text | In (“Female”,”Male”). |
| DateOfBirth | Date/Time | <=Date(). |
| PhoneNumber | Short Text | Optional or required according to policy. |
| ProgrammeID | Number / Long Integer | Foreign key. |
| AdmissionDate | Date/Time | Default Date(). |
| Active | Yes/No | Default Yes. |
Subjects
| Field | Type | Rule |
|---|---|---|
| SubjectID | AutoNumber | Primary key. |
| SubjectCode | Short Text | Required; unique. |
| SubjectName | Short Text | Required. |
| Credit | Number | >0. |
| ProgrammeID | Number / Long Integer | Foreign key. |
| Semester | Number | Between 1 And 2. |
Enrolments
| Field | Type | Rule |
|---|---|---|
| EnrolmentID | AutoNumber | Primary key. |
| StudentID | Number / Long Integer | Foreign key. |
| SubjectID | Number / Long Integer | Foreign key. |
| AcademicYear | Short Text | Example: 2026/2027. |
| Semester | Number | Between 1 And 2. |
| EnrolmentDate | Date/Time | Default Date(). |
Create a unique multi-field index on StudentID, SubjectID, AcademicYear and Semester to prevent duplicate enrolment.
Marks
| Field | Type | Rule |
|---|---|---|
| MarkID | AutoNumber | Primary key. |
| EnrolmentID | Number / Long Integer | Foreign key; unique when only one final mark is stored. |
| CourseworkMark | Number | Between 0 And 40. |
| FinalExamMark | Number | Between 0 And 60. |
| DateEntered | Date/Time | Default Now(). |
Payments
| Field | Type | Rule |
|---|---|---|
| PaymentID | AutoNumber | Primary key. |
| StudentID | Number / Long Integer | Foreign key. |
| PaymentDate | Date/Time | Default Date(). |
| AmountPaid | Currency | >0. |
| ReceiptNumber | Short Text | Required; unique. |
| PaymentMethod | Short Text | Cash, Bank, Mobile or another approved method. |
| Notes | Long Text | Optional. |
| Parent table | Child table | Connection |
|---|---|---|
| Programmes | Students | ProgrammeID to ProgrammeID. |
| Programmes | Subjects | ProgrammeID to ProgrammeID. |
| Students | Enrolments | StudentID to StudentID. |
| Subjects | Enrolments | SubjectID to SubjectID. |
| Enrolments | Marks | EnrolmentID to EnrolmentID. |
| Students | Payments | StudentID 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
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
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
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.
Balance: [ProgrammeFee] - Nz([TotalPaid],0)5. Parameter query by programme
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
- Open the form and add a valid record.
- Try leaving required fields empty.
- Try entering an invalid date or mark.
- Try entering a duplicate registration number.
- Try selecting a related value.
- Test all buttons and tab order.
- 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.
Some shortcuts depend on the Access version, current view and keyboard layout.
Exercise 1: Small contacts database
- Create a Contacts table with ContactID, FullName, PhoneNumber, Email, Town and Active.
- Set ContactID as AutoNumber primary key.
- Prevent duplicate phone numbers.
- Create a form for data entry.
- Create a query for active contacts in one selected town.
- Create a report sorted by name.
Exercise 2: Shop inventory
- Create Categories, Products, Suppliers and StockTransactions tables.
- Create relationships.
- Create a query to calculate stock in minus stock out.
- Create a low-stock query.
- Create a product form and transaction subform.
- Create a stock-value report.
Exercise 3: Library system
- Create Members, Books, BookCopies and Loans tables.
- Prevent one physical copy from having two open loans.
- Create a query for overdue books using Date() and DueDate.
- Create a loan form.
- Create overdue and borrowing-history reports.
Exercise 4: Advanced automation
- Create a split database.
- Create a local front-end copy.
- Create a startup menu.
- Add a button that exports a report to PDF.
- Add error handling.
- Create a backup and restore test.
Questions
- What is a database?
- What is the difference between a field and a record?
- Why does every table need a primary key?
- What is a foreign key?
- What does referential integrity do?
- What is the difference between a form and a report?
- What is a select query?
- Name four action-query types.
- Why should an action query be tested as a select query first?
- Why is a database split for many users?
- What is normalization?
- What is the difference between importing and linking?
- What does Compact and Repair do?
- Why should users have separate local front ends?
- When is Excel more suitable than Access?
Answer guide
- An organised collection of related data.
- A field is one type of fact; a record is one complete row about one item.
- It uniquely identifies every record and supports relationships.
- A field that stores the primary-key value from another table.
- It prevents invalid relationships and orphan records.
- A form is mainly for data entry and viewing; a report is mainly for formatted output.
- A query that displays selected data without changing the stored records.
- Append, Update, Delete and Make-Table.
- To confirm exactly which records will be changed.
- To separate shared tables from user-interface objects and improve multi-user reliability.
- Arranging data into sensible related tables to reduce repetition and update problems.
- Import copies data; linking keeps data in the external source.
- It reorganises the database file, can reduce file size and may repair minor problems.
- To avoid sharing one front-end file and to improve reliability and speed.
- When the main work is flexible calculations, modelling, charts or worksheet analysis.
| Term | Simple meaning |
|---|---|
| ACCDB | Modern Microsoft Access database file. |
| Action query | A query that changes data or creates a table. |
| AutoNumber | A field that automatically creates a unique number. |
| Back end | The shared file that contains tables in a split database. |
| Bound control | A form or report control connected to a field. |
| Caption | A friendly label shown instead of the field name. |
| Combo box | A control for selecting or typing a value. |
| Control | An item on a form or report, such as a text box or button. |
| Control Source | The field or expression used by a control. |
| Crosstab query | A summary query with row and column headings. |
| Data dictionary | Documentation of tables, fields, types and rules. |
| Datasheet View | A row-and-column view of data. |
| DBMS | Software used to manage databases. |
| Design View | A view used to change object structure. |
| Entity | A subject about which data is stored. |
| Expression | A formula used to calculate or evaluate a value. |
| Field | A column storing one type of fact. |
| Filter | A temporary way to show matching records. |
| Foreign key | A field that refers to another table’s primary key. |
| Form | An interface for entering and viewing data. |
| Front end | The user file containing links, queries, forms, reports and code. |
| Index | A structure that helps searching and sorting. |
| Join | A connection used by a query to combine records. |
| Junction table | A table that resolves a many-to-many relationship. |
| Lookup field | A field that presents values from a list or related table. |
| Macro | A set of Access automation actions. |
| Module | A container for VBA code. |
| Navigation Pane | The area that lists database objects. |
| Normalization | Organising data to reduce repetition and problems. |
| Null | No stored value; it is not the same as zero or an empty string. |
| Object | A table, query, form, report, macro or module. |
| ODBC | A standard connection method for many external databases. |
| Parameter query | A query that asks the user for a value. |
| Primary key | A unique identifier for each record. |
| Query | A saved question or data operation. |
| Record | A row containing one complete item. |
| Record Source | The table or query that provides data to a form or report. |
| Referential integrity | Rules that keep related records valid. |
| Relationship | A connection between tables. |
| Report | Formatted output for viewing, printing or sharing. |
| SQL | The language used to query and manage data. |
| Subform | A form inside another form, usually for related records. |
| Table | An object that stores records in fields. |
| Validation rule | A rule that rejects invalid data. |
| VBA | The programming language used for advanced Access automation. |
| Wildcard | A symbol used in pattern matching, such as * in Access Like criteria. |
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.
