Microsoft KB Archive/97772

= ACC: Unable to Use Hexadecimal or Octal Values in Properties =

PSS ID Number: 97772

Article Last Modified on 5/28/2003

-

The information in this article applies to:


 * Microsoft Access 1.0
 * Microsoft Access 1.1
 * Microsoft Access 2.0
 * Microsoft Access for Windows 95 7.0
 * Microsoft Access 97

-



This article was previously published under Q97772





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

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.

To determine the decimal equivalent of a hexadecimal or octal number, enter 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 enter a hexadecimal or octal number in a control property that expects a string expression (for example, ValidationRule), Microsoft Access converts what you entered to a literal string.

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

The following steps demonstrate how this applies to parameters that you may want to pass in a function.

Steps to Reproduce Behavior
 Open the sample database Northwind.mdb (or NWIND.MDB in versions 1.x and 2.0). Open the Products form in Design view. (or Add Products in versions 1.x and 2.0) Select the Product ID text box. On the View menu, click Properties. Set the text box's ValidationRule property to the following function:

=mytest(&HFF)

Note that Microsoft Access 97 returns the following error:

The Function you entered can't be used in this expression.

Note that Microsoft Access 7.0 returns the following error:

The expression you entered has an invalid syntax

Note that Microsoft Access versions 1.x and 2.0 convert the expression to:

=mytest(&quot;&HFF&quot;)

</li></ol>

Additional query words: hex oct

Keywords: kbprb kbusage KB97772

Technology: kbAccess100 kbAccess110 kbAccess200 kbAccess700 kbAccess95Search kbAccess97 kbAccess97Search kbAccessSearch kbZNotKeyword3

-

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

© 2004 Microsoft Corporation. All rights reserved.