[AccessD] Problem With Ageing Function

Gustav Brock Gustav at cactus.dk
Wed Feb 8 13:47:14 CST 2006


Hi Tom

Try:

Function Ageing(Dte As Date)

and pass a variable of datatype DateTime or specify US format: #m/d/yyyy#

lngResult = Ageing(#4/15/2006#)

/gustav


>>> tom.p at piedpiper.com.au 08-02-2006 06:09:06 >>>
Hi All....

I havent posted for a long time....shows I must be learning SOMETHING <grin>
but I have a problem now

I have written the function below to work out ageing in accounts but it does
not seem to work properly.....am I missing something stupid?

Is it to do with Access date formatting  (we in Oz use dd/mm/yyyy)

Any help would be apprec iated

The Variable (Dte) is of course the date of the transaction calling the
function

Function Ageing(Dte)
Dim D
D = Date
Dim Curr As Date
Curr = DateSerial(Year(D), Month(D), (0))
'Debug.Print Curr

Dim Day30 As Date
Day30 = DateSerial(Year(D), Month(D) - 1, (0) + 1)
'Debug.Print Day30

Dim Day60 As Date
Day60 = DateSerial(Year(D), Month(D) - 2, (0) + 1)
'Debug.Print Day60

Dim Over As Date
Over = DateSerial(Year(D), Month(D) - 1, (0))
'Debug.Print Over

'Ageing function......
'Using Todays date as 15/04/2006 then
    '( 0)Current should be > 31/03/2006

    '(30)30Days              1/03/2006 to 31/03/2006
    '(60)60Days              1/02/2006 to 28/02/2006
    '(90)Over 60Days       < 1/02/2006

Select Case Dte
Case Is > Curr 'CURRENT AMOUNT
    Ageing = 0
Case Day30 To Curr ' 30 Days
    Ageing = 30
Case Day60 To Over ' 60 Days
    Ageing = 60
Case Is < Over
    Ageing = 90
Case Else
End Select

End Function

Regards

Tom Keatley




More information about the AccessD mailing list