ACC: Unable to Use Hexadecimal or Octal Values in Properties

Last reviewed: May 28, 1997
Article ID: Q97772
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

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

  1. Open the sample database Northwind.mdb (or NWIND.MDB in versions 1.x and 2.0).

  2. Open the Products form in Design view. (or Add Products in versions 1.x and 2.0)

  3. Select the Product ID text box.

  4. On the View menu, click Properties.

  5. 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("&HFF")
    


Additional query words: hex oct
Keywords : FmsHowTo kbusage
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.