PC Review


Reply
Thread Tools Rate Thread

25th of month to 25th of month

 
 
Kathy Webster
Guest
Posts: n/a
 
      17th Oct 2006
Our reporting period is from the 25th of the month to the 25th of the next
month.

I have a [MonthReporting] field and a [YearReporting] control on a form
where the user selects the month and year they wish to report on. So if they
select, for example, October in the [MonthReporting] field, and 2006 in the
[YearReporting] field, I have to show them all records where the
[PaymentDate] is between September 25, 2006 and October 25, 2006.

Can anyone help?
TIA,
Kathy


 
Reply With Quote
 
 
 
 
Rick Brandt
Guest
Posts: n/a
 
      17th Oct 2006
Kathy Webster wrote:
> Our reporting period is from the 25th of the month to the 25th of the
> next month.
>
> I have a [MonthReporting] field and a [YearReporting] control on a
> form where the user selects the month and year they wish to report
> on. So if they select, for example, October in the [MonthReporting]
> field, and 2006 in the [YearReporting] field, I have to show them all
> records where the [PaymentDate] is between September 25, 2006 and
> October 25, 2006.
> Can anyone help?
> TIA,
> Kathy


SELECT *
FROM TabelName
WHERE DateField >= DateSerial(YearReporting, MonthReporting-1, 25)
AND DateField < DateSerial(YearReporting, MonthReporting, 26)

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


 
Reply With Quote
 
Kathy Webster
Guest
Posts: n/a
 
      17th Oct 2006
Many thanks!! How do you figure this stuff out??

"Rick Brandt" <(E-Mail Removed)> wrote in message
news:Rk9Zg.18707$(E-Mail Removed)...
> Kathy Webster wrote:
>> Our reporting period is from the 25th of the month to the 25th of the
>> next month.
>>
>> I have a [MonthReporting] field and a [YearReporting] control on a
>> form where the user selects the month and year they wish to report
>> on. So if they select, for example, October in the [MonthReporting]
>> field, and 2006 in the [YearReporting] field, I have to show them all
>> records where the [PaymentDate] is between September 25, 2006 and
>> October 25, 2006.
>> Can anyone help?
>> TIA,
>> Kathy

>
> SELECT *
> FROM TabelName
> WHERE DateField >= DateSerial(YearReporting, MonthReporting-1, 25)
> AND DateField < DateSerial(YearReporting, MonthReporting, 26)
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt at Hunter dot com
>



 
Reply With Quote
 
Rick Brandt
Guest
Posts: n/a
 
      18th Oct 2006
Kathy Webster wrote:
> Many thanks!! How do you figure this stuff out??


Hang around these groups for over a decade and you remember a couple things :-)

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


 
Reply With Quote
 
Kathy Webster
Guest
Posts: n/a
 
      18th Oct 2006
Is that all it takes? A decade?

"Rick Brandt" <(E-Mail Removed)> wrote in message
news:JgdZg.17368$(E-Mail Removed)...
> Kathy Webster wrote:
>> Many thanks!! How do you figure this stuff out??

>
> Hang around these groups for over a decade and you remember a couple
> things :-)
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt at Hunter dot com
>



 
Reply With Quote
 
Rick Brandt
Guest
Posts: n/a
 
      18th Oct 2006
Kathy Webster wrote:
> Is that all it takes? A decade?


Give or take.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


 
Reply With Quote
 
Kathy Webster
Guest
Posts: n/a
 
      18th Oct 2006
Aargh! Just when I thought all was right in the world....

I want to catch all payments made from 9/25/06 through 10/24/06.
My query criteria for [PaymentDate] is set to:

>DateSerial([forms]![ExcelExport]![YearReporting],[forms]![ExcelExport]![MonthReporting]-1,25)
>And
><DateSerial([forms]![excelExport]![YearReporting],[forms]![excelExport]![MonthReporting],24)


The [MonthReporting] control on my ExcelExport form is 10.
The [YearReporting] control on my ExcelExport form is 2006.

It is only selecting one record: Payment date 10/20/06.
It is omitting 6 other records whose payment date falls within the desired
range.

Helllp!



"Rick Brandt" <(E-Mail Removed)> wrote in message
news:T%dZg.17397$(E-Mail Removed)...
> Kathy Webster wrote:
>> Is that all it takes? A decade?

>
> Give or take.
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt at Hunter dot com
>



 
Reply With Quote
 
Kathy Webster
Guest
Posts: n/a
 
      18th Oct 2006
Ohmygod, I actually figured it out myself! I forgot to change it from > and
< to >= and <=.
The payments it was missing were the ones on the cutoff days, which is what
I was testing for...
Boy is my face red...

"Kathy Webster" <(E-Mail Removed)> wrote in message
news:PruZg.8812$(E-Mail Removed)...
> Aargh! Just when I thought all was right in the world....
>
> I want to catch all payments made from 9/25/06 through 10/24/06.
> My query criteria for [PaymentDate] is set to:
>
>>DateSerial([forms]![ExcelExport]![YearReporting],[forms]![ExcelExport]![MonthReporting]-1,25)
>>And
>><DateSerial([forms]![excelExport]![YearReporting],[forms]![excelExport]![MonthReporting],24)

>
> The [MonthReporting] control on my ExcelExport form is 10.
> The [YearReporting] control on my ExcelExport form is 2006.
>
> It is only selecting one record: Payment date 10/20/06.
> It is omitting 6 other records whose payment date falls within the
> desired range.
>
> Helllp!
>
>
>
> "Rick Brandt" <(E-Mail Removed)> wrote in message
> news:T%dZg.17397$(E-Mail Removed)...
>> Kathy Webster wrote:
>>> Is that all it takes? A decade?

>>
>> Give or take.
>>
>> --
>> Rick Brandt, Microsoft Access MVP
>> Email (as appropriate) to...
>> RBrandt at Hunter dot com
>>

>
>



 
Reply With Quote
 
Rick Brandt
Guest
Posts: n/a
 
      19th Oct 2006
Kathy Webster wrote:
> Ohmygod, I actually figured it out myself! I forgot to change it from
> > and < to >= and <=.

> The payments it was missing were the ones on the cutoff days, which
> is what I was testing for...
> Boy is my face red...


Actually you normally want >= on the low date and < on the high date while using
one day past the value you actually want. That is IF your date values also have
time components other than midnight (zero).

If your dates contain non-midnight times then <= on the high date will only
match records that are exactly at midnight on that day. Therefore you really
need < midnight of the following day.

If all of your dates have midnight as the time then what you are using now is
fine. Note that none of this has anything ot do with how you are formatting
your dates for display.


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


 
Reply With Quote
 
Kathy Webster
Guest
Posts: n/a
 
      19th Oct 2006
Thank you. Point very well taken. Sometimes I forget about that little time
component that has bit me in the butt on several occasions...

"Rick Brandt" <(E-Mail Removed)> wrote in message
news:RoAZg.12337$(E-Mail Removed)...
> Kathy Webster wrote:
>> Ohmygod, I actually figured it out myself! I forgot to change it from
>> > and < to >= and <=.

>> The payments it was missing were the ones on the cutoff days, which
>> is what I was testing for...
>> Boy is my face red...

>
> Actually you normally want >= on the low date and < on the high date while
> using one day past the value you actually want. That is IF your date
> values also have time components other than midnight (zero).
>
> If your dates contain non-midnight times then <= on the high date will
> only match records that are exactly at midnight on that day. Therefore
> you really need < midnight of the following day.
>
> If all of your dates have midnight as the time then what you are using now
> is fine. Note that none of this has anything ot do with how you are
> formatting your dates for display.
>
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt at Hunter dot com
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
25th May 2010 Becky News Editions 0 25th May 2010 07:02 PM
Changing over 25th Nov itsme General Discussion 5 20th Nov 2008 11:28 AM
Viewing in Month view shows 25th June 2007 =?Utf-8?B?U3Rld2FydA==?= Microsoft Outlook Calendar 0 31st Jul 2007 12:28 PM
printing Little Current month and Little Next month on Banner when it should little PRIOR month and little Next month. jake_allen10@hotmail.com Microsoft Outlook 0 3rd Nov 2006 07:30 PM
Eliminating every 25th row Lram Microsoft Excel Worksheet Functions 5 16th Oct 2005 11:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:19 PM.