tech on the net
Home About Us Feedback Site Map

Microsoft

Access Excel Word

Database

SQL Oracle / PLSQL SQL Server MySQL MariaDB PostgreSQL

Web Development

HTML CSS Color Picker

Language

C Language

More

ASCII Table Linux UNIX Java Clipart Joke of the Moment

Other Sites

CheckYourMath BigActivities
Share this page:

MS Access: Mid Function

Learn how to use the Access Mid function with syntax and examples.

Description

The Microsoft Access Mid function extracts a substring from a string (starting at any position).

Syntax

The syntax for the Microsoft Access Mid function is:

Mid ( text, start_position, number_of_characters )

Parameters or Arguments

Text is the string that you wish to extract from.

Start_position indicates the position in the string that you will begin extracting from. The first position in the string is 1.

Number_of_characters indicates the number of characters that you wish to extract. If you omit this parameter, the Mid function will return all characters after the start_position.

Applies To

The Mid function can be used in the following versions of Microsoft Access:

Example

Mid ("Tech on the Net", 1, 4) would return "Tech"
Mid ("Alphabet", 5, 2) would return "ab"
Mid ("Alphabet", 5) would return "abet"

Example (in VBA Code)

The Mid function can be used in VBA code in Microsoft Access. For example:

Dim LResult As String

LResult = Mid ("Alphabet", 5, 2)

The variable LResult would now contain the value of "ab".

If you omitted the number_of_characters parameter in the above example:

Dim LResult As String

LResult = Mid ("Alphabet", 5)

The variable LResult would now contain the value of "abet", since omitting the final parameter will return all characters after the start_position.

Example (in SQL/Queries)

You can also use the Mid function in a query in Microsoft Access.

Microsoft Access