Microsoft KB Archive/209592

= Unable to use hexadecimal or octal values in properties when using Access =

Article ID: 209592

Article Last Modified on 1/23/2007

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q209592



Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SYMPTOMS
You cannot use hexadecimal or octal values referenced as &Hxxxx (for hexadecimal numbers) or &Oxxxx (for octal numbers) in the properties of a control.



CAUSE
Most control properties "expect" either a string expression or a decimal number.



RESOLUTION
Use decimal numbers rather than hexadecimal or octal numbers.

TIP: You can determine the decimal equivalent of a hexadecimal or octal number by typing that number in the BorderColor property of a control (first write down the original value of the property so that you can easily restore it). Microsoft Access converts hexadecimal and octal numbers (&H or &O format) entered in the color properties of a control to decimal numbers.



MORE INFORMATION
If you type a hexadecimal or octal number in a control property that "expects" a string expression (for example, ValidationRule), Microsoft Access converts what you typed to a literal string.

If you type a hexadecimal or octal number in a control property that "expects" a number with the Long Integer data type (for example, BackColor), Access converts what you typed to a decimal number.

To see how this behavior applies to parameters that you may want to pass in a function, follow the steps below.

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

Steps to Reproduce Behavior
 Start Microsoft Access, and then open the sample database Northwind.mdb or the sample project NorthwindCS.adp. Open the Products form in Design view. Select the Product ID text box. If the property sheet is not already visible, click Properties on the View menu. Set the text box's ValidationRule property to the following function:

=mytest(&HFF)

You receive the following error message:

The expression you entered contains invalid syntax.

You may have entered a comma without a preceding value or identifier.

</li></ol>

Additional query words: hex oct

Keywords: kbprb kbusage KB209592

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.