Orderby Function

  • Thread starter Thread starter R
  • Start date Start date
R

R

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.
 
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.
 
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.
 
Back
Top