Database Problems

  • Thread starter Thread starter James
  • Start date Start date
J

James

Hello is there any way in access's database window that I
could sort queries,tables etc in proper numerical order...

I.E. 1,2,3,4,5,6,7,8,9,10,11

Rather than 1,10,11,2,3,4,5,6,7,8,9

Thanks

James
 
Access / JET sorts numerical values correctly as per your first example if
you feed it numerical values.

If it sorts as per your 2nd example, it is almost certainly because the
values given were *TEXT* values rather than numerical values. This can be
either the Field is a Text Field or some processing was done before sorting.
For example, if you use the Format() on the numerical values, the results
are variants of Text type and no longer numerical values.
 
Yes but I would like it sorting as proper numerical values
my first example in the database window... At the current
moment it dosent as it does the second example? How do I
get around this in the database window?

Thanks

James
 
Do you mean the names of the Tables or Queries?

If you do, name are Text so you need to name them like

01...
02...
....
10...
11...
....
20...
21...
....

I previously thought you meant Field values.
 
Hi James,

You can't! The database window is listing the textual names of the objects.
So it's sorting them as text. If you rename the objects 01, 02, 03, etc,
then it'll sort. It's just like file names or folders in Windows Explorer.

However, I would advise you to adopt the Reddick naming convention so that
you (and others should your work have a life after you move on from it) can
understand what each object is when it's referred to elsewhere. Trust me: I
work as an Access developer, and I get paid to rewrite workable databases
that are impossible to understand because the previous author didn't use a
naming convention.

So, I'd urge you to look up 'Reddick', or 'VBA naming convention' on MSDN,
and look for a tool like 'Rick Fisher's Find and Replace', or 'Speed Ferret'
that can safely rename your objects wherever they are referenced.

All the best,

Andrew Webster
 
could sort queries,tables etc in proper numerical
order..
It sounds like you are attempting to prefix the names of your tables, queries, etc. with numbers to have them appear in the order you want in the database window

If that is so, add leading Zeros

if the number is less than 10, add one leading 0 (zero) as in

01_tblCustomer
02_tblOrder
03_tblPayMent
..., 09, 10, 11 ,12, etc

(I used the underscore for seperation - it is not necessary
The names will appear in the order you want

If you use numbers greater than 99 but less than 1000, for numbers under 10 use 001, 002; between 10 and 99 use 010 , 011, ... 099

001_tblCustomer
020_tblOrder
300_tblPayment

Stev
 
Back
Top