A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Why do queries automaticly rearange columns?



 
 
Thread Tools Display Modes
  #1  
Old June 26th, 2008, 02:01 PM posted to microsoft.public.access.queries
Frank1927
external usenet poster
 
Posts: 1
Default Why do queries automaticly rearange columns?

Why are columns are in a different sequence each time I run certain queries
and how can I stop it?

  #2  
Old June 26th, 2008, 02:59 PM posted to microsoft.public.access.queries
Michel Walsh
external usenet poster
 
Posts: 2,404
Default Why do queries automaticly rearange columns?

Use a form. Controls won't move all around your form.

A table does not have to respect the 'column' ordering you use at their
creation time. For a query, in Jet, the alias has to be to the left of any
computed column using that alias, but other than that, columns 'may' move
around.

Don't use table or query to VIEW data for production (ok for debugging
though, but not for the final production): use a form.


Vanderghast, Access MVP



"Frank1927" wrote in message
...
Why are columns are in a different sequence each time I run certain
queries
and how can I stop it?



  #3  
Old June 27th, 2008, 08:31 PM posted to microsoft.public.access.queries
Stephen K. Young
external usenet poster
 
Posts: 3
Default Why do queries automaticly rearange columns?


For a query, in Jet, the alias has to be to the left of any
computed column using that alias


That is not true in my experience. The computed column can be anywhere
relative to the alias. Just tested it in Access 2003.

- Steve


  #4  
Old June 30th, 2008, 02:04 PM posted to microsoft.public.access.queries
Michel Walsh
external usenet poster
 
Posts: 2,404
Default Why do queries automaticly rearange columns?

Indeed, it seems the actual behavior is that you can define the alias at the
right of its use. On the other hand, now, if you use an alias having the
same name as a field, even if you are at the left of the alias definition,
you get the alias, not the field, neither an error:


"Stephen K. Young" sky @ stanley associates . com wrote in message
...

For a query, in Jet, the alias has to be to the left of any
computed column using that alias


That is not true in my experience. The computed column can be anywhere
relative to the alias. Just tested it in Access 2003.

- Steve



  #5  
Old June 30th, 2008, 02:06 PM posted to microsoft.public.access.queries
Michel Walsh
external usenet poster
 
Posts: 2,404
Default Why do queries automaticly rearange columns?

The example I used, in Northwind:

SELECT CustomerID & Freight, CustomerID & Orders.Freight, "Hello" AS Freight
FROM Orders;



Vanderghast, Access MVP


"Stephen K. Young" sky @ stanley associates . com wrote in message
...

For a query, in Jet, the alias has to be to the left of any
computed column using that alias


That is not true in my experience. The computed column can be anywhere
relative to the alias. Just tested it in Access 2003.

- Steve



  #6  
Old June 30th, 2008, 03:44 PM posted to microsoft.public.access.queries
Stephen K. Young
external usenet poster
 
Posts: 3
Default Why do queries automaticly rearange columns?

Well, I can see how that query would confuse Access. You have created an
alias name of "Freight" that is identical to the existing field name
Orders.Freight, so Access as no way to distinguish the alias. This has
nothing to do with left/right placement.

If you use a different alias name, Access has no difficulty figuring it out,
whether the alias is placed to the left or right.

The point being -- I believe that left/right placement has no effect on
using an alias in other calculated fields.

- Steve


"Michel Walsh" vanderghast@VirusAreFunnierThanSpam wrote in message
...
The example I used, in Northwind:

SELECT CustomerID & Freight, CustomerID & Orders.Freight, "Hello" AS
Freight
FROM Orders;



Vanderghast, Access MVP


"Stephen K. Young" sky @ stanley associates . com wrote in message
...

For a query, in Jet, the alias has to be to the left of any
computed column using that alias


That is not true in my experience. The computed column can be anywhere
relative to the alias. Just tested it in Access 2003.

- Steve





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.