Dates in AC2000

H

HD

I just can't figure it out myself. could somebody help me?
Access 2000
the problem:

I have one Date field, which can only schow the first of the month, no
further.
I have to add 10 days to that. Like: +10
after the tenth day, if the paymnt was not made, a label will be visible,
saying Overdue.
(I got the label right).

The fields:
PaymntDue : first day of month only. Has to change every month by itself.
Overdue : first day + 10
Days overdue : count the days to see how many days late.
Todays Date : should show automatically for each day. (Format ?)

PaidOnTime : If it was paid, a chkBox = true(checked manually), then it is
finished, Overdue will not show.

I tried this all day today (the Dates), no success!

Code is either in the Form (or Query ?). How do I format the Date fields in
code?
I did look in AC Help, I could not find anything which would've helped me.

I would like to use a update qry so the results update (or append?) into the
table CustPayments.
That would mean it should be a query for the day calculations I believe ?

Any help, so I can make this work ?
 
M

missinglinq via AccessMonster.com

Here are the various dates you need. I placed them in the Form_Current event,
which means they'll be calculated for each account when you go to the record.
Note that some dates are predicated on the previous date being calculated, so
in your code they have to be in the same order.

This assumes controls on your form named TodaysDate, PaymentDue, Overdue,
and DaysOverdue.

‘Sets current date, dates for 1st of current month, +10 days, difference from
now and Overdue date

Private Sub Form_Current()
Me.TodaysDate.Value = Date
Me.PaymentDue.Value = DateSerial(Year(Date), Month(Date), 1)
Me.Overdue.Value = DateAdd("d", 10, Me.PaymentDue.Value)
Me.DaysOverdue.Value = DateDiff("d", Me.Overdue.Value, TodaysDate)
End Sub

You can then base the visibilty of your Overdue label and so forth on these
dates.

Note that I corrected your typo and changed PaymntDue to PaymentDue.





Good Luck!
 
H

HD

Need help one more time, then I won't ask no more :)

As I have now the first day of the month, that will change for each future
month.
great.
now I still need to go back to previous months.

I have the 2 fields: PMonth and PYear.

when I scroll back to, say, December, 2006, I need to see First of December
plus the 10 days,
if it was paid. (Have chkbox for that Y/N).
(some customers pay 2 months together, like Dec & Jan).

I was thinking, I could append the data from each month into a history or
archive table, then create a report from that and it would show me all the
outstanding fees. I believe that would be one way.
but I also would like to learn how to do it a better way.

Me.TodaysDate.Value = Date (this would be the End date for the
Overdue.Value)
Me.PaymentDue.Value = DateSerial(Year(Date), Month(Date), 1) ( ??? This
would show the first day of a previous month, like December).
Me.Overdue.Value = DateAdd("d", 10, Me.PaymentDue.Value) ( ??? and this the
tent day of that month).
Me.DaysOverdue.Value = DateDiff("d", Me.Overdue.Value, TodaysDate) (this
will calculate from the tent day of December to today or any previous
months).

I wish I would know how or where to learn more about this. I find it very
interesting. Books ?
 

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