Parameter query......query!

  • Thread starter Thread starter k.roberts
  • Start date Start date
K

k.roberts

Hi

I am looking for some assistance.

My end result is a report that will display records for a certain
month.

I need to create a parameter query that prompts the user to enter a
month or maybe select from a drop down list. This is qhat I need help
with - specifically what I need to enter as criteria in the Date field.

Then I will attach this query to a report, so when the user clicks on a
command button to run a report, they are prompted to enter the month
required, then the report is displayed with the corresponding records
from that month.

Any help given would be greatly appreciated.
 
Just the month - easy! In the column of the query bring down your date field
and modify it to look like so:
TheMonth: Month([YourDateField])

In the Criteria put the following with the brackets:
[Enter the Numerical Month]

Run it and enter the number 1 which will give you any records created in
January. Any records from January. Doesn't care about the year.

Is any year a problem? Would you like typing in "June" instead of 6? How
about something like "June" and "2005" ? Just let us know.
 
Hi that's great, haven't had a chance to try this out yet. The user
will be typing in the month as 'June'. The records will be needed from
this current year. So if I ask the user to enter the month and year in
numerical format, as 1/2006, what would I need to change your thingy
above to?

Also can you please confirm where exactly need to put
Month([YourDateField])?
 
Hi,

The Month([YourDateField]) would be at the top of a QBE grind column in the
Field row. The "YourDateField" needs to be the name of your date field and be
sure that it IS a date field as opposed to a date stored in a text field.

To accept a prompt for the entire month spelt out:
TheMonth: Format([YouDateField],"mmmm")
The criteria:
[Enter the Month]

If you remove one of the m's above, then they would only need to type Feb
instead of February.

For the year part you have some choices. If it is ALWAYS the current year,
bring down your date field into a new column like so:

TheYear: Year([YouDateField])
The criteria:
Year(Date())

Or if you'd like to check other years the criteria would be:
[Enter the Year]

That way they would be prompted for both the Month and Year. If you don't
want to see this information returned in a query, remove the checkmark in
those columns.
 
Back
Top