ACC: Unable to Use Hexadecimal or Octal Values in Properties

ID: Q97772


The information in this article applies to:


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          : kbusage FmsHowto 
Version           : 1.0 1.1 2.0 7.0 97
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: March 23, 1999