Month calculation

H

Harmannus

Hallo,

What am i doing wrong?

If Month(Me.Billingdate) = 1 Then
Me.[PeriodID].Value = 2
End If

If date is 28-01-2004 is should return 1 meaning periodid=2
The month doesn't compute right somehow. I don't get a good value. What am i
doing wrong here....

Any suggestions on how to efficiently set the period for a given date? The
idea is that the bill gets payd following the month it was filed. So bill
january gets payed february. Following the above i have to make 12 if then
statements. Is there a more efficient way?

Thanx for any tips.

Regards,
Harmannus
 
K

Ken Snell

You don't say what the "doesn't compute right somehow" means?

However, an efficient way to do what you seek:

Me.PeriodID.Value = (Month(Me.Billingdate) Mod 12) + 1
 
H

Harmannus

Hallo,

I didn't retern the right period to match the periodid value....

But you suggestion did the trick ;-) Great. Thanx for the help.

Regards,
Harmannus


Ken Snell said:
You don't say what the "doesn't compute right somehow" means?

However, an efficient way to do what you seek:

Me.PeriodID.Value = (Month(Me.Billingdate) Mod 12) + 1


--
Ken Snell
<MS ACCESS MVP>

Harmannus said:
Hallo,

What am i doing wrong?

If Month(Me.Billingdate) = 1 Then
Me.[PeriodID].Value = 2
End If

If date is 28-01-2004 is should return 1 meaning periodid=2
The month doesn't compute right somehow. I don't get a good value. What
am
i
doing wrong here....

Any suggestions on how to efficiently set the period for a given date? The
idea is that the bill gets payd following the month it was filed. So bill
january gets payed february. Following the above i have to make 12 if then
statements. Is there a more efficient way?

Thanx for any tips.

Regards,
Harmannus
 

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