More date issues

M

Mike

Hi,

I need to pass on a month as field to a report which uses stored procedure
to process data. Right now I use date_start and date_end as a range
parameter but because the report is based on a full month, I prefer select
the month (and the year). So can it be done? I'm thinking of a combobox
which lists the months (and year?).

TIA

Mike
 
J

John W. Vinson

Hi,

I need to pass on a month as field to a report which uses stored procedure
to process data. Right now I use date_start and date_end as a range
parameter but because the report is based on a full month, I prefer select
the month (and the year). So can it be done? I'm thinking of a combobox
which lists the months (and year?).

TIA

Mike

You can use a criterion such as
= DateSerial([Enter year:], [Enter month number:], 1) AND < DateSerial([Enter year:], [Enter month number:] + 1, 1)

Of course you can and probably should use form references such as
[Forms]![frmCriteria]![txtMonth] rather than the prompt; these could be combo
boxes displaying year numbers and month numbers 1-12 if you wish.

John W. Vinson [MVP]
 
K

KARL DEWEY

I do not think AND < DateSerial([Enter year:], [Enter month number:] + 1, 1)
will work for December.

So try this ---
AND < DateAdd("m",1,DateSerial([Enter year:], [Enter month number:] , 1))

--
KARL DEWEY
Build a little - Test a little


John W. Vinson said:
Hi,

I need to pass on a month as field to a report which uses stored procedure
to process data. Right now I use date_start and date_end as a range
parameter but because the report is based on a full month, I prefer select
the month (and the year). So can it be done? I'm thinking of a combobox
which lists the months (and year?).

TIA

Mike

You can use a criterion such as
= DateSerial([Enter year:], [Enter month number:], 1) AND < DateSerial([Enter year:], [Enter month number:] + 1, 1)

Of course you can and probably should use form references such as
[Forms]![frmCriteria]![txtMonth] rather than the prompt; these could be combo
boxes displaying year numbers and month numbers 1-12 if you wish.

John W. Vinson [MVP]
 
K

KARL DEWEY

I tested it and to my suprise it actually works.
--
KARL DEWEY
Build a little - Test a little


KARL DEWEY said:
I do not think AND < DateSerial([Enter year:], [Enter month number:] + 1, 1)
will work for December.

So try this ---
AND < DateAdd("m",1,DateSerial([Enter year:], [Enter month number:] , 1))

--
KARL DEWEY
Build a little - Test a little


John W. Vinson said:
Hi,

I need to pass on a month as field to a report which uses stored procedure
to process data. Right now I use date_start and date_end as a range
parameter but because the report is based on a full month, I prefer select
the month (and the year). So can it be done? I'm thinking of a combobox
which lists the months (and year?).

TIA

Mike

You can use a criterion such as
= DateSerial([Enter year:], [Enter month number:], 1) AND < DateSerial([Enter year:], [Enter month number:] + 1, 1)

Of course you can and probably should use form references such as
[Forms]![frmCriteria]![txtMonth] rather than the prompt; these could be combo
boxes displaying year numbers and month numbers 1-12 if you wish.

John W. Vinson [MVP]
 
J

John W. Vinson

I do not think AND < DateSerial([Enter year:], [Enter month number:] + 1, 1)
will work for December.

Actually, it will:

?dateserial(2007, 13, 1)
1/1/2008
?dateserial(2008, -24, 1)
12/1/2005
?dateserial(1990,1,3653)
1/1/2000

DateSerial is pretty clever.

John W. Vinson [MVP]
 

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