🧾 SQL References & Functions
Estimated reading: 3 minutes 209 views

MS Access Functions – String, Date, Math, and Domain Explained

Introduction – Why MS Access Functions Matter

Microsoft Access is not just a databaseβ€”it’s a full-fledged application platform with built-in functions to transform data, perform calculations, validate inputs, and drive automation. Whether you’re building queries, forms, reports, or macros, Access functions allow you to work smarter and more efficiently.

In this guide, you’ll learn:

  • The most-used MS Access functions grouped by purpose
  • Syntax and examples for calculations, strings, dates, and logic
  • Unique Access-only functions and how to use them
  • Use cases in queries, forms, and reports

1. Categories of Access Functions

CategoryExamplesPurpose
Math & NumbersRound(), Abs(), Sqr()Perform calculations and rounding
String/TextLeft(), Mid(), Instr(), Len()Clean and extract text
Date/TimeDate(), Now(), DateDiff(), DateAdd()Manipulate and calculate with dates
Logical/ControlIIf(), Nz(), Switch()Handle logic, nulls, and conditions
DomainDLookup(), DSum(), DCount()Access values from related tables
SystemCurrentUser(), Environ()Get environment/user/session info

2. String Functions in Access

Examples

SELECT Left([FirstName], 3) AS ShortName FROM Employees;
SELECT Mid([Email], InStr(1, [Email], "@") + 1) AS Domain FROM Customers;
SELECT Len([Notes]) AS NoteLength FROM Issues;

Instr() helps find the position of a substring. Use Trim() to clean user input.


3. Math & Number Functions

Examples

SELECT Abs([-45]) AS PositiveValue;
SELECT Round([Price] * 1.2, 2) AS PriceWithTax FROM Products;
SELECT Sqr([SideLength]) AS Area FROM Squares;

Great for budgeting, invoicing, scoring, and measurements.


4. Date/Time Functions

Examples

SELECT Date() AS Today;
SELECT DateDiff("yyyy", [BirthDate], Date()) AS Age FROM Members;
SELECT DateAdd("m", 6, [JoinDate]) AS RenewalDue FROM Subscriptions;

Use Format([DateField], "mm/dd/yyyy") to customize output.


5. Logical and Null Handling

Examples

SELECT IIf([Score] >= 60, "Pass", "Fail") AS Result FROM Exams;
SELECT Nz([Phone], "Not Provided") AS SafePhone FROM Contacts;
SELECT Switch([Rating] = 5, "Excellent", [Rating] >= 3, "Good", True, "Poor") FROM Reviews;
  • IIf() is Access’s inline IF.
  • Nz() replaces NULL with a default value.

6. Domain Functions (Used in Queries, Forms, Reports)

FunctionDescriptionExample
DLookup()Retrieves a single value from another tableDLookup("Price", "Products", "ProductID=5")
DSum()Calculates total of a fieldDSum("Total", "Orders", "CustomerID=12")
DCount()Counts rows that match a conditionDCount("*", "Invoices", "Status='Open'")

Used heavily in Access reports and controls to pull related data.


7. Useful System/Utility Functions

SELECT CurrentUser();           -- Logged-in user
SELECT Environ("USERNAME");     -- Windows user name

Great for logging, conditional form behavior, and admin control.


8. Where to Use MS Access Functions

ContextFunction Usage Example
QueriesSELECT IIf(...) FROM ...;
Forms (Control Source)=DLookup("Name", "Employees", "ID=Forms!Orders!EmployeeID")
Reports=Format(Date(), "mmmm yyyy")
Macros/VBAIf DCount(...) > 0 Then

Summary – Recap & Best Practices

MS Access functions allow you to build dynamic, interactive, and intelligent databases without external code. You can do calculations, validate inputs, display friendly text, and retrieve related data all within your queries and forms.

Key Takeaways:

  • Use built-in functions for strings, dates, math, and nulls
  • Domain functions are vital for cross-table value lookups
  • Format and logic functions simplify UI and reporting

Real-World Relevance:
Essential in Access apps used in education, accounting, government, and small business workflows

FAQ – MS Access Functions

Can I use Excel-style formulas in Access?

Many Excel-like functions exist in Access (Left, Round, IF = IIf, etc.).

What is the difference between IIf() and Switch()?

IIf() is binary; Switch() handles multiple conditions like a cascading IF.

What’s the purpose of domain functions?

They retrieve or calculate values from related tables without JOINsβ€”especially useful in forms and reports.

How do I handle NULL values in Access?

Use Nz([Field], 'default') to replace NULL with a value.


Share Now :
Share

πŸ“‚ MS Access Functions

Or Copy Link

CONTENTS
Scroll to Top