ACC: Objects Cannot Be User-Defined Data Type Elements (96420)



The information in this article applies to:

  • Microsoft Access 1.0
  • Microsoft Access 1.1
  • Microsoft Access 2.0

This article was previously published under Q96420

SYMPTOMS

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

When you attempt to use a Microsoft Access defined object data type as a user-defined data type element, you may receive the following error message:
Expected: Integer or Long or Single or Double or Currency or String or Variant or Identifier.

CAUSE

Objects predefined by Microsoft Access are not supported as user-defined data type elements.

STATUS

This behavior no longer occurs in Microsoft Access version 7.0.

MORE INFORMATION

Microsoft Access defines eight object data types: Control, Database, Dynaset, Form, QueryDef, Report, Snapshot, and Table. You can use the Type statement in the Declarations section of a module to define your own data type. The user-defined data type cannot be one of the eight predefined data types.

Steps to Reproduce Behavior


  1. Create a new module.
  2. In the Declarations section, attempt to define a structure as follows:
          Type ControlInfo
            Ctl as Control
          End Type
    						
  3. From the Run menu, choose Compile All. Note that you receive the error message mentioned earlier in this article.

REFERENCES

For more information, search for "Type Statement," and then "Object Data Types" using the Microsoft Access Help menu.

Microsoft Access "Introduction to Programming," version 1.0, Chapter 5, "Variables, Constants, and Data Types," page 43

Modification Type:MajorLast Reviewed:5/9/2003
Keywords:kbfix kbprb kbprogramming KB96420