Sorting Numbers

D

Denise

I have a table that has questions number 1 to 150.

When you sort A to Z it puts the numbers like,

1, 11, 100, etc.

How do you get the numbers to sort in numerical order. I have added and
deleted some questions so the new records go to the end.

thanks.
 
D

Duane Hookom

If you have numbers in a text field and you want to sort them as if the field
were numeric, you will need to change the Sorting and Grouping expression
from the field name to something like:

=Val([Field Name])
 
D

Denise

Duane,

Where do I put that expression in the table?

Where do I put that expression in the query?

Where do I put that expression in the form?

Where do I put that expression in the report?

Yes it is a text field because I have 20a, 20b, 20c and 20d, etc.

Thanks.

Denise



--
Denise B.


Duane Hookom said:
If you have numbers in a text field and you want to sort them as if the field
were numeric, you will need to change the Sorting and Grouping expression
from the field name to something like:

=Val([Field Name])

--
Duane Hookom
Microsoft Access MVP


Denise said:
I have a table that has questions number 1 to 150.

When you sort A to Z it puts the numbers like,

1, 11, 100, etc.

How do you get the numbers to sort in numerical order. I have added and
deleted some questions so the new records go to the end.

thanks.
 
D

Duane Hookom

You seem to have forgotten to mention there are letters as well as numbers.
This solution should work either way as long as the numbers are always first.

" change the Sorting and Grouping expression " this is in the report design.
The only reliable method for sorting a report is to use this dialog.

--
Duane Hookom
Microsoft Access MVP


Denise said:
Duane,

Where do I put that expression in the table?

Where do I put that expression in the query?

Where do I put that expression in the form?

Where do I put that expression in the report?

Yes it is a text field because I have 20a, 20b, 20c and 20d, etc.

Thanks.

Denise



--
Denise B.


Duane Hookom said:
If you have numbers in a text field and you want to sort them as if the field
were numeric, you will need to change the Sorting and Grouping expression
from the field name to something like:

=Val([Field Name])

--
Duane Hookom
Microsoft Access MVP


Denise said:
I have a table that has questions number 1 to 150.

When you sort A to Z it puts the numbers like,

1, 11, 100, etc.

How do you get the numbers to sort in numerical order. I have added and
deleted some questions so the new records go to the end.

thanks.
 
D

Denise

Duane,

I also use a query to lookup the questions in a combo box? How do I get the
numbers to fall in order here?

Thanks.

Denise
--
Denise B.


Duane Hookom said:
You seem to have forgotten to mention there are letters as well as numbers.
This solution should work either way as long as the numbers are always first.

" change the Sorting and Grouping expression " this is in the report design.
The only reliable method for sorting a report is to use this dialog.

--
Duane Hookom
Microsoft Access MVP


Denise said:
Duane,

Where do I put that expression in the table?

Where do I put that expression in the query?

Where do I put that expression in the form?

Where do I put that expression in the report?

Yes it is a text field because I have 20a, 20b, 20c and 20d, etc.

Thanks.

Denise



--
Denise B.


Duane Hookom said:
If you have numbers in a text field and you want to sort them as if the field
were numeric, you will need to change the Sorting and Grouping expression
from the field name to something like:

=Val([Field Name])

--
Duane Hookom
Microsoft Access MVP


:

I have a table that has questions number 1 to 150.

When you sort A to Z it puts the numbers like,

1, 11, 100, etc.

How do you get the numbers to sort in numerical order. I have added and
deleted some questions so the new records go to the end.

thanks.
 
D

Duane Hookom

You would use the same Val() function in the Row Source of your combo box.

SELECT YourField
FROM YourTable
ORDER BY Val(YourField);

--
Duane Hookom
Microsoft Access MVP


Denise said:
Duane,

I also use a query to lookup the questions in a combo box? How do I get the
numbers to fall in order here?

Thanks.

Denise
--
Denise B.


Duane Hookom said:
You seem to have forgotten to mention there are letters as well as numbers.
This solution should work either way as long as the numbers are always first.

" change the Sorting and Grouping expression " this is in the report design.
The only reliable method for sorting a report is to use this dialog.

--
Duane Hookom
Microsoft Access MVP


Denise said:
Duane,

Where do I put that expression in the table?

Where do I put that expression in the query?

Where do I put that expression in the form?

Where do I put that expression in the report?

Yes it is a text field because I have 20a, 20b, 20c and 20d, etc.

Thanks.

Denise



--
Denise B.


:

If you have numbers in a text field and you want to sort them as if the field
were numeric, you will need to change the Sorting and Grouping expression
from the field name to something like:

=Val([Field Name])

--
Duane Hookom
Microsoft Access MVP


:

I have a table that has questions number 1 to 150.

When you sort A to Z it puts the numbers like,

1, 11, 100, etc.

How do you get the numbers to sort in numerical order. I have added and
deleted some questions so the new records go to the end.

thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top