Caption overiding Select AS

M

Morris.C

Why is the Caption field in my table overiding the SELECT Table1.Field1 AS
["1st Field"] statement?

If I remove the Caption value from the table, the SELECT ### AS "&&&"
works!
 
A

Allen Browne

The field name in the query is actually the alias you specify, but it uses
the Caption for display purposes on that assumption that this is what you
want if you specified a caption.

If you OpenRecordset() or examine:
currentdb.QueryDefs("Query1").Fields(1).Name
you will find that is uses your alias.

If you create a form based on the query, you will see your alias as the
field name in the Field List. If you drag the field from the Field List onto
the form, you get a text box that has its Name and ControlSource set to your
alias. However, the attached label of this text box displays the Caption for
the field. That's how captions work.

In the same way, when you view the output of the query directly, you see the
Caption, and not the Name of the field. Similarly, if you use the query as
the RowSource for a listbox that has ColumnHeads, you see the Caption over
the column.

In general, captions are not a very useful idea.
 
Top