Unable to use hexadecimal or octal values in properties when using Access (209592)



The information in this article applies to:

  • Microsoft Access 2000
  • Microsoft Access 97

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

  1. Start Microsoft Access, and then open the sample database Northwind.mdb or the sample project NorthwindCS.adp.
  2. Open the Products form in Design view.
  3. Select the Product ID text box.
  4. If the property sheet is not already visible, click Properties on the View menu.
  5. 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.

Modification Type:MajorLast Reviewed:2/2/2005
Keywords:kbprb kbusage KB209592