Query by end date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I have built a database, and I can't seem to be able to query by
month. I have setup the daily and yearly queries, but month only works for
the present month, not past ones. I have a nice print screen of my query,
but I guess we can't post files up here, so it may be a bit difficult to
explain what I've done. The database indexes by computer dates, so If I back
the computer date to last month, the query works fine. I am using a
parameter to prompt the user for an end date. Then the query is set to take
the 1st of the month, to the end date using this in the criteria:

field: TheDate
criteria: Between Day(Date()) And [Enter End Date:]

Field: expr:Month(TheDate)
criteria: Month(Date())

I understand why it doens't work, but I'm not sure if there's a statement to
tell it to take the month that was inputed in the [Enter End Date:] of the
parameter statement.

Thx for any help
Eric
 
You will need to write your criteria to look something like:

BETWEEN DateSerial(Year([Enter End Date:]), Month([Enter End Date:]), 1) AND
[Enter End Date:]

The DateSerial Function will return a date value that matches the Year,
Month, and Day that are entered (in that order). So to return results from
the first of the month, thru [Enter End Date], of the same month, you will
have to pass the year and month values to match the those entered for [Enter
End Date].

HTH
Dale
 
Back
Top