Home page
or browse popular tags
Access Functions

Sign up for the free email newsletter for new tips, tutorials and more. Enter your email address below, and then click the button.

Privacy Policy

RSS Twitter

Access: Mid Function


In Access, the Mid function returns a string containing a specified number of characters from a string.

The syntax for the Mid function is:

Mid( (string, start [, length]) )

string String expression from which another string is created. This can be any string expression. If string contains Null, Null is returned.

start   Long expression that indicates the character position in string at which the part to be taken begins. If start is greater than the number of characters in string, Mid returns a zero-length string ("").

length   Long expression that indicates the number of characters to return. If omitted or if there are fewer than length characters in the text (including the character at start), all characters from the start position to the end of the string are returned.


Mid ("WebCheatSheet",1,3 )              returns " Web"
Mid ("access functions",8,4)               returns "func"
Mid ("access functions",8)                  returns "access functions"

VBA Code

Dim MyString
MyString = "Mid Function"
ResultWord = Mid(MyString, 1, 3)

This example uses the Mid function to return a specified number of characters from a string. Now the ResultWord variable would contain the value "Mid".

SQL query

You can also use the Mid function in a query.

SELECT Mid([ItemDesired],2,5) AS Expr1
FROM Orders

If you'd like to see how it works, enter SQL statement and press Execute


Add To: Add to dzone dzone | Digg this digg | Add to del.icio.us del.icio.us | Stumble it stumbleupon

  • Comments

Copyright © 2005-2023             www.WebCheatSheet.com All Rights Reserved.