UNIHIVE

Study Hub UNIPORT CSC 282

CSC 282 · Database Programming

Building a database in MS Access

Tables, field properties, relationships, queries, forms, reports and macros in a desktop database.

Our notes

2 min read

What Access is

A desktop DBMS in Microsoft Office (Windows) that keeps tables, queries, forms, reports, macros and code in one file (.accdb). Good for small offices and for learning; for many users over a network, a server DBMS is better. LibreOffice Base is a free alternative with the same ideas.

Tables

  • Create in Design View: field names, data types (Short Text, Long Text, Number, Currency, Date/Time, Yes/No, AutoNumber, Lookup), and the primary key (key icon).
  • Field properties give validation: Field Size, Format, Input Mask (for a phone pattern), Default Value, Validation Rule (Between 0 And 100) with a Validation Text message, Required, Indexed (Yes, No Duplicates).

Relationships

Database Tools → Relationships: drag the primary key onto the matching foreign key, tick Enforce Referential Integrity, and choose cascade update or delete if wanted. Lines show 1 and ∞ ends.

Queries

  • Select query in the Query Design grid: add tables, pick fields, set Criteria (">=4.5", "Like 'O*'"), Sort, and Totals (Group By, Sum, Avg, Count).
  • Parameter query: criteria in square brackets, e.g. [Enter level], asks the user each time.
  • Action queries: Make-Table, Append, Update, Delete (they change data: back up first).
  • Calculated field: GradePoint: IIf([Score]>=70,5,IIf([Score]>=60,4,IIf([Score]>=50,3,IIf([Score]>=45,2,IIf([Score]>=40,1,0))))). (UNIPORT and most Nigerian universities use a 5-point scale; check your handbook's bands.)

Every Access query is SQL underneath: switch to SQL View to see it.

Forms

Screens for entering and viewing data one record at a time. Use the Form Wizard, then adjust in Layout or Design view: combo boxes for lookups, buttons for actions, a subform for the "many" side (a student form with a subform of results).

Reports

Formatted output for printing: grouping levels (by department), sorting, totals in group footers, page headers. A transcript or a class list is a report.

Macros and VBA

Macros automate steps (open a form, run a query) without code. VBA (Visual Basic for Applications) gives full programming: loops over records, checks before saving (BeforeUpdate event), custom messages.

Practical workflow

  1. Design on paper (ER diagram, normalised tables).
  2. Create tables with keys and validation.
  3. Set relationships with referential integrity.
  4. Enter test data.
  5. Build queries, then forms and reports on them.
  6. Back up the .accdb file regularly; use Compact and Repair to keep it healthy.

Exams usually ask

  • Name Access objects and what each is for.
  • Write a criteria expression or a calculated field.
  • Describe how to enforce referential integrity.

Common mistake

Typing the same lookup values (department names) by hand in every record. Put them in their own table and use a combo box, so spelling stays consistent.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All CSC 282 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.