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: Space Function


In Access, the Space function returns a string consisting of the specified number of spaces.

The syntax for the Space function is:

Space( number )

The argument number specifies the number of spaces you want in the string. It can be of any numeric data type, but is rounded to a Long and must be between 0 and approximately 65,535, inclusive.


Space(2)    returns "  "
Space(7)    returns "       "

VBA Code

Dim MyStr, MyString
MyString = Space(3)

' Insert 5 spaces between two strings.
MyStr = "Test" & Space(5) & "string"

This example uses the Space function to return a string consisting of a specified number of spaces. Now the MyString variable would contain the value " ", and the MyStr variable would contain the value "test string"

SQL query

You can also use the Asc function in a query.

SELECT Space(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.