[AccessD] Problem With Ageing Function

Stuart McLachlan stuart at lexacorp.com.pg
Wed Feb 8 00:04:55 CST 2006


What's not working, it seems to work fine for me (using dd/mm/yy here).

I put
D = DateValue("15/04/2006")
in place of D = Date
and it gave the correct responses to dates in the ranges set out below.

On 8 Feb 2006 at 13:09, Tom Keatley wrote:

> 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
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

-- 
Stuart





More information about the AccessD mailing list