PRB: Field's Caption Property Overrides Its Query Alias

    Article ID: Q127973
    Creation Date: 22-MAR-1995
    Revision Date: 01-DEC-1996

    The information in this article applies to:

    • Microsoft Access versions 2.0, 7.0, 97

    SYMPTOMS

    Novice: Requires knowledge of the user interface on single-user computers.

    You run a query that contains a field with an alias, but the field's alias is not displayed. Instead, you see the Caption property for the field.

    CAUSE

    In a query, the Caption property for a field in a table takes precedence over the field's alias.

    RESOLUTION

    To override the Caption property, set the field's Caption property in the query to the alias you want to use. To do this, click the field in the query grid, click Properties on the View menu, and enter the alias in the Caption property field.

    MORE INFORMATION

    Steps to Reproduce Behavior

     1. Open the sample database Northwind.mdb (or NWIND.MDB in version 2.0).
    
     2. Create a new table with one field with the following properties:
    
           Table: My_Table
           --------------------------
           Field Name: Test1
              Data Type: Text
              Caption: MyTableCaption
    
     3. Save the table as My_Table. When you are prompted to create a primary
        key, choose No. Close the table.
    
     4. Select the My_Table table in the Database window.
    
     5. Create a new query based on the new table. On the Insert menu, click
        Query (or in version 2.0, on the File menu, click New, and then
        Query). In the New Query dialog box, select Design View (or in version
        2.0, click the New Query button). The new query opens in Design view
        with the My_Table field list displayed.
    
     6. Double-click the Test1 field in the field list. Note that the field
        appears in the query design grid.
    
     7. Create an alias for the Test1 field by typing "MyQueryAlias:" (without
        the quotation marks) at the beginning of the field name "Test1" in the
        query design grid.
    
     9. Run the query. Note that the column heading is MyTableCaption, the
        field's Caption property in the table, instead of the alias you
        created in step 8.
    
    
  • On the View menu, click Query Design. Click the Test1 field in the query design grid. On the View menu, click Properties. Set the Caption property to "MyQueryCaption" (without the quotation marks).
  • Run the query. Note that the field column heading is the caption set in the query field properties.
  • REFERENCES

    For more information about the Caption property, search the Help Index for "Caption property," or ask the Microsoft Access 97 Office Assistant.


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.
©1997 Microsoft Corporation. All rights reserved. Legal Notices.

KBCategory: kbusage
KBSubcategory: QryOthr
Additional reference words: 2.00 7.00 97 8.00 qbe