0% found this document useful (0 votes)
23 views3 pages

MS Access Notes and Question

The document provides practical notes on Microsoft Access, detailing its components such as tables, queries, forms, reports, macros, and VBA scripting. It includes a comprehensive scenario for a supermarket database, outlining the structure of tables and the types of queries, forms, and reports needed for managing sales transactions. Additionally, it poses questions regarding database design, query criteria, and security optimization.

Uploaded by

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

MS Access Notes and Question

The document provides practical notes on Microsoft Access, detailing its components such as tables, queries, forms, reports, macros, and VBA scripting. It includes a comprehensive scenario for a supermarket database, outlining the structure of tables and the types of queries, forms, and reports needed for managing sales transactions. Additionally, it poses questions regarding database design, query criteria, and security optimization.

Uploaded by

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

Microsoft Access Practical Notes & Comprehensive Question

1. Microsoft Access Practical Notes

1.1 Introduction to MS Access


Microsoft Access is a database management system (DBMS) that allows users to store,
manage, and manipulate data efficiently. It is used for small to medium-sized databases and
supports various components like tables, queries, forms, reports, macros, and VBA
scripting.

1.2 Key Components of MS Access


1. Tables – Used to store data in rows and columns, similar to spreadsheets.
2. Queries – Retrieve, update, and manipulate data from tables using SQL.
3. Forms – User-friendly interfaces for data entry and management.
4. Reports – Used for data visualization and summarization.
5. Macros – Automate repetitive tasks without coding.
6. VBA (Visual Basic for Applications) – Enhances automation with custom scripts.

1.3 Working with Tables in MS Access


• Creating a Table: Go to Create → Table Design and define fields.
• Defining a Primary Key: Select a field that uniquely identifies each record.
• Relationships: Connect related tables via Foreign Keys to ensure data integrity.

1.4 Queries in MS Access


Queries are used to extract and manipulate data. Types of queries include:
• Select Query – Retrieves data based on conditions.
• Update Query – Modifies existing records.
• Delete Query – Removes records based on criteria.
• Append Query – Adds records to another table.
• SQL Query – Uses SQL commands to perform operations.

Example SQL Query to retrieve orders placed in January 2025:

SELECT * FROM Orders WHERE OrderDate BETWEEN #01/01/2025# AND #01/31/2025#;

1.5 Forms in MS Access


Forms provide a user-friendly way to enter and manage data.
• Creating a Form: Use the Form Wizard or Form Design View.
• Adding Controls: Use text boxes, combo boxes, and buttons for data entry.

1.6 Reports in MS Access


Reports are used to summarize and present data in an organized format.
• Creating a Report: Use the Report Wizard or Report Design View.
• Sorting & Grouping: Group data by categories (e.g., sales per product).
1.7 Macros & VBA in MS Access
• Macros automate tasks like opening forms or reports.
• VBA (Visual Basic for Applications) allows custom scripting for advanced automation.

Example VBA code to warn if stock is low:

Private Sub Form_Load()


If Me.StockQuantity < 10 Then
MsgBox "Stock running low!", vbCritical, "Stock Alert"
End If
End Sub

2. Comprehensive MS Access Database Question

2.1 Scenario
ABC Supermarket wants a database to manage sales transactions. The database should
store customer details, product inventory, employee information, and sales records.

2.2 Tables & Data Provided

Customers Table
CustomerID | FirstName | LastName | City | Phone

101 | John | Kamau | Nairobi | 0712345678

102 | Amina | Hassan | Mombasa | 0723456789

103 | Brian | Otieno | Kisumu | 0734567890

104 | Lucy | Wanjiru | Nakuru | 0745678901

Products Table
ProductID | ProductName | Category | Price (KSh) | StockQuantity

201 | Sugar (1kg) | Grocery | 150 | 50

202 | Rice (5kg) | Grocery | 700 | 30

203 | Bread | Bakery | 80 | 100

204 | Cooking Oil (3L) | Grocery | 800 | 20

Orders Table
OrderID | CustomerID | ProductID | OrderDate | Quantity | TotalPrice (KSh)

301 | 101 | 201 | 2025-01-02 | 2 | 300

302 | 102 | 202 | 2025-01-05 | 1 | 700


303 | 103 | 203 | 2025-01-06 | 3 | 240

304 | 104 | 204 | 2025-01-08 | 1 | 800

Employees Table
EmployeeID | FirstName | LastName | Role | Phone

501 | Peter | Mwangi | Cashier | 0711122233

502 | Jane | Ndungu | Sales Clerk | 0722233344

503 | David | Omondi | Manager | 0733344455

2.3 Questions
1. Database Design (Tables & Relationships)
- Identify the Primary Keys for each table.
- Set up Relationships between the tables, ensuring Referential Integrity.

2. Queries
(a) Select Query: Retrieve all orders placed in January 2025.
(b) Update Query: Increase the price of all grocery products by 5%.
(c) Delete Query: Remove customers from Nairobi who haven't placed an order in the last 6
months.
(d) SQL Query: List the top 2 best-selling products based on total quantity sold.

3. Forms
- Design a Customer Entry Form with a Combo Box for selecting the city.
- Include a Submit Button that saves the record.

4. Reports
- Generate a Monthly Sales Report showing total revenue per product.
- Group the report by Product Category and sort it by total sales.

5. Macros & VBA


- Create a Macro that opens the Orders Form when the database starts.
- Write a VBA script that displays a warning if any product's stock falls below 10.

Final Task
Build this database in MS Access and answer the following:
1. What criteria did you use in your Select Query for January 2025 orders?
2. How did you ensure only 'Grocery' products were affected in your Update Query?
3. How does your VBA script trigger a warning for low stock?
4. How did you optimize database security and performance?

You might also like