Newbie said:
The form has a date eg 12/12/02. Based on the entry here the query is
supposed to return records summed by month for the previous 12 mths
however, the query only works properly if a month end date is entered.
therefore if the user enters 12/12/02 I want the query to read this as
31/12/02.
If everything already works when the last day of a month is
entered on the form, then, instead of trying to modify the
query, why not just make the form adjust the date when it is
entered? This is easy to do in the dtpDateFrom text box's
After Update event procedure using the last day of the month
expression (DateSerial) mentioned earlier.
Me.dtpDateFrom = DateSerial(Year(Me.dtpDateFrom), _
Month(Me.dtpDateFrom) + 1, 0)
THis would also allow you to enter just the month and year
(Access will use the first of the month when you don't
specify the day) such as 12/02 or Dec 2002 or ...
Is the Query Parameter box just telling the query where to look for the
info? i.e on the form
Yes, but it has to tell it the control on the form too.
That's why I said the parameter is probably:
Forms!frmConToolsCriteria!dtpDateFrom
whereas you have mentioned several variations that have left
me wondering what you're actually referring to.
Then, in the body of the query, you have to refer to the
value on the form **exactly** the same as specified in the
parameter. It might help to think of the parameter as a way
to tell the query what to do with something it ordinarily
would not know how to process.
and the column heading syntax telling it what to do once it has found it?
ie. dateserial(etc etc)
Is this how it works?
No. The Column Heading is a special designation for a
crosstab query that tells the query which data goes into
which columns. A parameter can be used just about anywhere
in an Access query, not only for what you are doing.
--
Marsh
MVP [MS Access]