Sorting

R

Reen

Hi,
I need to resend letters according to the date they were originally sent
out. They are all in a database under "date mailed" How do I sort them so I
get only October?
Thank you.
 
K

KARL DEWEY

It is not a matter of 'sorting' but setting criteria.
In design view use a calculated field like this --
Mail_Month_Year: Format([date mailed], "mmyyyy")
In criteria row put --
"102009"
 
J

Jerry Whittle

Sorting is the order that you want the records returned. Since you want just
a part of the records in the table, the proper terminology is "returned".

Also a 'database' is a collection of objects. Tables, which hold data, are a
type of object. The records you want are in a table.

A query returns records from a table. To return certain records, you need
criteria in a query. That will limit the records returned.

So create a new query based on the table holding the letter records. In the
criteria row under date field put the following:

Between #1 October 2009# and #31 October 2009# + .99999

The .99999 takes care of a small problem if there is both date and time
stored in the field.
 
K

KenSheridan via AccessMonster.com

A simple solution would be to base a form for report on a query which prompts
for the year and month as parameters, the latter as a number, 1 to 12:

SELECT *
FROM [YourTable]
WHERE YEAR([date mailed]) = [Enter year:]
AND MONTH([date mailed]) = [Enter month as number:]
ORDER BY [date mailed];

The ORDER BY clause will sort the records in ascending date order. If you
use the query as the RecordSource for a report, however, use the report's
internal sorting and grouping mechanism to sort the records rather than doing
it in the query.

When you open the form or report you'll be prompted to enter the year and
date, so to return this month's records you'd enter 2009 and then 10.

Ken Sheridan
Stafford, England
 

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