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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Orderby Function



 
 
Thread Tools Display Modes
  #1  
Old February 18th, 2010, 06:46 PM posted to microsoft.public.access.forms
R
external usenet poster
 
Posts: 29
Default Orderby Function

I have a address subform on a persons form. I want to order the addresses by
the type of address (ie. Primary, Work, Parents etc). I have a field "Type"
which specifies what address it is, which I would use for the Orderby, BUT I
want the PRIMARY addresses to be first on the list. Unfortunatly, I can't
just do a DESC order because there are address types such as work or Uncle.

Is there some way I can specify the first type to show...I don't even care
if everything after is alph or not. I just want the Primary address to be
the one that shows first.

I am up to coding it if I have to but I don't know where to even start.

Thanks for any suggestions in advance.
  #2  
Old February 18th, 2010, 07:02 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Orderby Function

A common approach is to build a table that contains all the types of
addresses, along with a sort field (i.e. Primary would be 1, Business could
be 2, Parents could be 3 and so on). You'd join that table to your existing
table, and sort on the sort field.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"R" wrote in message
...
I have a address subform on a persons form. I want to order the addresses
by
the type of address (ie. Primary, Work, Parents etc). I have a field
"Type"
which specifies what address it is, which I would use for the Orderby, BUT
I
want the PRIMARY addresses to be first on the list. Unfortunatly, I can't
just do a DESC order because there are address types such as work or
Uncle.

Is there some way I can specify the first type to show...I don't even care
if everything after is alph or not. I just want the Primary address to be
the one that shows first.

I am up to coding it if I have to but I don't know where to even start.

Thanks for any suggestions in advance.


  #3  
Old February 18th, 2010, 07:19 PM posted to microsoft.public.access.forms
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Orderby Function

Create a Sort table with fields like this --
tblSort --
Type Sort
Primary 1
Work 2
Parents 3
etc 4

In your query join it to the Type field and add the Sort field to the grid
for sorting.

--
Build a little, test a little.


"R" wrote:

I have a address subform on a persons form. I want to order the addresses by
the type of address (ie. Primary, Work, Parents etc). I have a field "Type"
which specifies what address it is, which I would use for the Orderby, BUT I
want the PRIMARY addresses to be first on the list. Unfortunatly, I can't
just do a DESC order because there are address types such as work or Uncle.

Is there some way I can specify the first type to show...I don't even care
if everything after is alph or not. I just want the Primary address to be
the one that shows first.

I am up to coding it if I have to but I don't know where to even start.

Thanks for any suggestions in advance.

 




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 01:33 AM.


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