Mentioned
In
|
 |
 |
 |
 |
Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms
of Use |
Trademarks
Article ID: 826763 - Last Review: February 19, 2008 - Revision: 3.1 Error message when you use special characters in Access databasesThis article applies to either a Microsoft Access database (.mdb) file or to a Microsoft Access database (.accdb) file, and to a Microsoft Access project (.adp) file. On This PageSYMPTOMSWhen you use special characters in Access, you experience one of the following problems. Problem 1You use one of the following special characters in the name of a table field: - Accent grave (`)
- Exclamation mark (!)
- Period (.)
- bracket([])
- Leading space
- Non-printable characters
In this case, you receive the following error message: The field name is not valid. Make sure that the name doesn’t contain a period(.), exclamation point(!), bracket([]), leading space, or non-printable character such as a carriage return. If you have pasted the name from another application, try pressing ESC and typing the name again. If you use these special characters in a table name, you receive the following error message: The object name 'TableName' you entered doesn't follow Microsoft Office Access object-naming rules. Problem 2You create a query expression. The query expression includes fields that contains special characters. Depending on the specific special characters, you receive one of the following error messages: - If the field name contains a space character, a question mark (?), or an at sign (@), you receive the following error message:
The Expression you entered contains invalid syntax. You may have entered an operand without an operator - If the field name contains a quotation mark(") or an apostrophe('), you receive the following error message:
The Expression you entered has an invalid string. A string can be up to 2048 characters long, including opening and closing quotation marks. - If the field name contains a number sign (#), you receive the following error message:
The expression you entered has an invalid date value. - If the field name contains a percent sign (%), a tilde (~), a semicolon (;), or a bracket ([]), you receive the following error message.
The Expression you entered contains invalid syntax. You omitted an operand or operator, you entered an invalid character or comma, or you entered text without surrounding it in quotation marks. - If the field name contains a brace ({}), you receive the following error message.
Malformed GUID in query expression 'ObjectName' - If the field name contains a bracket ([]) or parenthesis (()), you receive the following error message:
The expression you entered is missing a closing parenthesis, bracket (]), or vertical bar(|).
Problem 3You have a query that contains query expressions. The query expressions include fields that contain special characters. When you run the query, you are promoted to enter a parameter value. Typically, this problem occurs when you use the following special characters: - Greater than sign (>)
- Less than sign (<)
- Period (.)
- Asterisk (*)
- Colon (:)
- Caret (^)
- Plus sign (+)
- Backslash (\)
- Equal sign (=)
- Ampersand (&)
- Slash mark (/)
WORKAROUNDTo work arond this problem, do not use special characters. If you must use special characters in query expressions, enclose the special characters in brackets ([]). For example, if you want to use the greater than sign (>), use [>]. MORE INFORMATIONMicrosoft Access does not restrict the use of special
characters such as a number sign (#), a period (.), or a quotation mark (")
in the database object names or in the database field names. However, if
you do use the special characters, you may experience unexpected errors.
Therefore, Microsoft recommends that you do not use the special characters in
the database object names in the Access database or in the database project.
This article discusses the special characters that you must avoid because of
known issues with these special characters. When you work with Access or with some other application
such as a Microsoft Visual Basic application or an Active Server Pages (ASP)
application, you must avoid the following special characters:
Collapse this tableExpand this table | Space | | | Apostrophe | ' | | Quotation mark | " | | Apostrophe | ' | | At sign | @ | | Grave accent | ` | | Number sign | # | | Percent | % | | Greater than sign | > | | Less than sign | < | | Exclamation mark | ! | | Period | . | | Brackets | [ ] | | Asterisk | * | | Dollar sign | $ | | Semicolon | ; | | Colon | : | | Question mark | ? | | Caret | ^ | | Braces | { } | | Plus sign | + | | Hyphen | - | | Equal sign | = | | Tilde | ~ | | Backslash | \ |
Access naming conventionsMicrosoft recommends that you do not use a period (.), an
exclamation mark (!), a grave accent (`), a bracket ([ ]), a space ( ), or a
quotation mark (") inside the names of functions, the names of
variables, the names of fields, or the names of database objects such as tables
and forms. There are known problems that occur if you use
the following special characters in Access. The following scenarios describe
when you must not use the special characters:
- When you export the database objects to other file formats
such as a Microsoft Excel file format, an HTML file format, or a text file
format, do not use a number sign (#) or a period (.) in the database object
names or in the field names.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
308686Â
(http://kbalertz.com/Feedback.aspx?kbNumber=308686/
)
Special characters in field names are changed when you export a table to a different file format in Access 2000
- When you use hyperlinks in Access, the hyperlinks are
stored as modified Memo fields with a number sign (#) as a delimiter.
Therefore, the number sign is regarded as a reserved word in Access. Do not use
the number sign when you create hyperlinks.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
162855Â
(http://kbalertz.com/Feedback.aspx?kbNumber=162855/
)
Cannot hyperlink to documents that have "#" in the name in Access 97
- When you import a text file into Access and that text file
contains tabs or other special characters, the special characters are
converted, and then the special characters appear as boxes. Therefore, when you
try to use the imported table, you receive unexpected errors. You must not use
the special characters in the source table when you import into
Access.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
210433Â
(http://kbalertz.com/Feedback.aspx?kbNumber=210433/
)
Sample function to replace or to remove special characters in an MDB in Access 2000
- When you use ASP forms to add or to modify data in an
Access database, you must not use a percent sign (%), a plus sign (+), or a
caret (^) in the form. These special characters may not translate correctly in
the Access database.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
163334Â
(http://kbalertz.com/Feedback.aspx?kbNumber=163334/
)
How to use percent, plus, and caret symbols in ASP forms in Access 97
- When you use Full-width languages, do not use Full-width
characters in the name of database objects or in the name of controls. For
example, you must not use Full-width parentheses when you use Full-width
languages This may cause compile errors if there is code in an event procedure
for the object or for the control.
APPLIES TO- Microsoft Office Access 2007
- Microsoft Office Access 2003
- Microsoft Access 2002 Standard Edition
- Microsoft Access 2000 Standard Edition
- Microsoft Access 97 Standard Edition
| kbexport kbdesign kbdatabase kbusage kbinfo KB826763 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please
|
 |
 |
 |
 |
 |
 |
 |
| |