Monthly Querry

G

Guest

i have a querry which search sales between 2 dates. where i have to put
dates. e.g mm/dd/yyyy.

what i want is to put 1 to 12 which r months and i get search results for
any sale between the date 01 upto 31st of the month.

The command am using is: Between [Enter Starting Sales Date MM/DD/YY] And
[Enter Ending Sales Date MM/DD/YY]

can someone help me fix this issue.

regards
aamer sheikh
 
T

Todd Shillam

Aamer said:
i have a querry which search sales between 2 dates. where i have to put
dates. e.g mm/dd/yyyy.

what i want is to put 1 to 12 which r months and i get search results for
any sale between the date 01 upto 31st of the month.

The command am using is: Between [Enter Starting Sales Date MM/DD/YY]
And
[Enter Ending Sales Date MM/DD/YY]

can someone help me fix this issue.

regards
aamer sheikh

Add an expression to your query, call it "fMonth". To do this, open your
query in design mode. In a blank field at the end, enter the following--this
should work if I did this right:

fMonth: Month([MyDate])

NOTE: Change "MyDate" to your date field name in your query.

When you run the select query, it will display the month number--you can do
the same thing for year too if necessary.

Best regards,

Todd
 
V

Van T. Dinh

Do you want a particular month of ALL years or a particular month of a
specific year.

I you want the later case, you need to use 2 Parameters rather than one with
criteria like:

BETWEEN DateSerial([Enter Year:], [Enter Month:], 1)
AND DateSerial([Enter Year:], [Enter Month:] + 1, 0)

type as one line in the criteria row of the Date Field Column.

I assume your Field only store date values only, i. e. without the non-zero
time component.

HTH
Van T. Dinh
MVP (Access)
 
G

Guest

Thank you Van T

BETWEEN DateSerial([Enter Year:], [Enter Month:], 1)
AND DateSerial([Enter Year:], [Enter Month:] + 1, 0)

The above Works fine, but i dont need the Year only month, What criteria
statement should I use for the MONTH only regardless of the year.

regards
aamer sheikh




Do you want a particular month of ALL years or a particular month of a
specific year.

I you want the later case, you need to use 2 Parameters rather than one with
criteria like:

BETWEEN DateSerial([Enter Year:], [Enter Month:], 1)
AND DateSerial([Enter Year:], [Enter Month:] + 1, 0)

type as one line in the criteria row of the Date Field Column.

I assume your Field only store date values only, i. e. without the non-zero
time component.

HTH
Van T. Dinh
MVP (Access)



Aamer said:
i have a querry which search sales between 2 dates. where i have to put
dates. e.g mm/dd/yyyy.

what i want is to put 1 to 12 which r months and i get search results for
any sale between the date 01 upto 31st of the month.

The command am using is: Between [Enter Starting Sales Date MM/DD/YY] And
[Enter Ending Sales Date MM/DD/YY]

can someone help me fix this issue.

regards
aamer sheikh
 
D

Douglas J Steele

You sure you don't need year? Do you really want to retrieve records from
August 2004 AND August 2005 at the same time?

If so, one approach (although it'll be much slower) is to add a computed
field to your query that retrieves the month from date, and use the [Enter
Month:] as the criteria.

You'd put something like WhatMonth: Month([MyDateField]) in the "Field" row
of the grid, and [Enter Month:] in the "Criteria" row.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Aamer said:
Thank you Van T

BETWEEN DateSerial([Enter Year:], [Enter Month:], 1)
AND DateSerial([Enter Year:], [Enter Month:] + 1, 0)

The above Works fine, but i dont need the Year only month, What criteria
statement should I use for the MONTH only regardless of the year.

regards
aamer sheikh




Do you want a particular month of ALL years or a particular month of a
specific year.

I you want the later case, you need to use 2 Parameters rather than one with
criteria like:

BETWEEN DateSerial([Enter Year:], [Enter Month:], 1)
AND DateSerial([Enter Year:], [Enter Month:] + 1, 0)

type as one line in the criteria row of the Date Field Column.

I assume your Field only store date values only, i. e. without the non-zero
time component.

HTH
Van T. Dinh
MVP (Access)



Aamer said:
i have a querry which search sales between 2 dates. where i have to put
dates. e.g mm/dd/yyyy.

what i want is to put 1 to 12 which r months and i get search results for
any sale between the date 01 upto 31st of the month.

The command am using is: Between [Enter Starting Sales Date
MM/DD/YY]
And
[Enter Ending Sales Date MM/DD/YY]

can someone help me fix this issue.

regards
aamer sheikh
 

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