Trick for ColumnName

  • Thread starter Thread starter x-rays
  • Start date Start date
X

x-rays

Hello all,

I have a simple select query, I have a date column that formatted as
"dd/mm/yyyy". When doing this the column must have an alias column name
instead of the original one, what I mean:

Select Key, Format(DateCol, "dd/mm/yyyy") as DateCol1

If I use as an alias col. name the real col. name DateCol:

Select Key, Format(DateCol, "dd/mm/yyyy") as DateCol

then access appears the message "Circular reference caused by alias
'DateCol' in query definition's SELECT list"

Is there any trick to appear the column with its original name?

Thanks in advance!
 
You just might get away with it if you include the table name:
Select Key, Format([Table1].[DateCol], "dd/mm/yyyy") as DateCol
FROM Table1

Not sure I would recommend that though.
 
Hi Allen,

Thank you very much, I'll see how it goes with the data and decide to
use the technique or not.

Allen said:
You just might get away with it if you include the table name:
Select Key, Format([Table1].[DateCol], "dd/mm/yyyy") as DateCol
FROM Table1

Not sure I would recommend that though.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

x-rays said:
Hello all,

I have a simple select query, I have a date column that formatted as
"dd/mm/yyyy". When doing this the column must have an alias column name
instead of the original one, what I mean:

Select Key, Format(DateCol, "dd/mm/yyyy") as DateCol1

If I use as an alias col. name the real col. name DateCol:

Select Key, Format(DateCol, "dd/mm/yyyy") as DateCol

then access appears the message "Circular reference caused by alias
'DateCol' in query definition's SELECT list"

Is there any trick to appear the column with its original name?

Thanks in advance!
 
Is there any trick to appear the column with its original name?

I'd try using a new name, and using the field's Caption property to
display the old name.

Or... display it on a Continuous Form, where you can put anything you
please in a Label control.

John W. Vinson[MVP]
 
Fabulous! Three-pointer, Mr. Browne!

A very timely Q&A that I have "gotten away with"! Thank you!

Allen Browne said:
You just might get away with it if you include the table name:
Select Key, Format([Table1].[DateCol], "dd/mm/yyyy") as DateCol
FROM Table1

Not sure I would recommend that though.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

x-rays said:
Hello all,

I have a simple select query, I have a date column that formatted as
"dd/mm/yyyy". When doing this the column must have an alias column name
instead of the original one, what I mean:

Select Key, Format(DateCol, "dd/mm/yyyy") as DateCol1

If I use as an alias col. name the real col. name DateCol:

Select Key, Format(DateCol, "dd/mm/yyyy") as DateCol

then access appears the message "Circular reference caused by alias
'DateCol' in query definition's SELECT list"

Is there any trick to appear the column with its original name?

Thanks in advance!
 
Back
Top