The information in this article applies to:
SUMMARYMORE INFORMATIONSteps to Reproduce BehaviorThe following code reproduces the problem. The code below assumes that you have an Access database called "db1.mdb" in the root of the C drive:Sample Code
To reproduce this problem in Access, open up a table in Design View. In the
Default Value Edit field, enter 1abc (without quotation marks) and then
click on another field.
SYMPTOMSIf you try to set the default value for a text field with a string that starts with a number (for example, 11North), you will get an error. If you set the DAO Struct CDaoFieldInfo fi field member as:
and then call CDaoTableDef::CreateField(fi), DAO throws an exception
reporting:
If you open the Access table in Design View, click the General Tab, and try to enter 11North in the Default Value field, Access displays an error dialog box with the message:
CAUSEThe error occurs because Access accepts expressions for the default value. (Expressions are operators, constants, functions, literal values, and so on.) When the default value begins with a number, Access tries to store the default as a number. RESOLUTIONYou must use double quotes so that Access knows the default value is a string. For example, to do this programmatically, the code is:
If you are working directly with an Access table in Design View, you must
start the string with a quote. For example, "11North".
Additional query words: kbvc500 kbvc600 kbmfc
Keywords : kbDAO |
Last Reviewed: July 28, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |