Get last month date filter..??

Hi all , i want to modified form Chart Of Accounts (form 16)
so there will be a field beside net change that show Last Month Net change
for example I give date filter 02/15/09…02/28/09
so the the net change date filter should be 02/15/09…02/28/09
and new field (lAst month net change) should be 01/15/09…01/28/09

how to do that?
thanks

Dear Stan,

As in Ax we use PrevMth(Date) method to get the previous month’s same date.

EX: 21/06/2010 is returned if we give PrevMth(today) where today is 21/07/2010.

hope it helps you!

PrevMth(today) ??

are you sure?

i cannot…

it’s error

Hi Stan,

Have a look at the code in the Function FindPeriod in the “G/L Balance” form or you can use the INCDATE function

In Axpata , PrevMth(Date _Date) is a method which returns the previous months date

Hi Prasan,

This is a Nav forum which explains the confusion.

Hi,

Just play around the function Date := DMY2DATE(Day [, Month] [, Year])

Try this:

  1. create a blank form (even without an associated table)

  2. add the following variables

Variable name Type
StartDate Date
EndDate Date
month Integer
CurrYear Integer

  1. add 3 text boxes and associate them with month, StartDate, EndDate

  2. add a command button

  3. place the following code to the onPush trigger:

CurrYear := DATE2DMY(TODAY,3); StartDate := 0D; EndDate := 0D;

IF month = 0 THEN
month := 1;

// date filters

StartDate := DMY2DATE(01, month, CurrYear); // StartDate will be the date of the first day of the month
EndDate := DMY2DATE(01, month+1, CurrYear)-1; // EndDate will be the last day of the month

// month+1 => increments the month (for the next month)

// DMY2DATE(01, month+1, CurrYear)-1 => the -1 decrements a day to the date calculated by the DMY2DATE formula.

  1. Now enter a month in the month text box (1…12).

  2. Press the command button

If you enter month 2… you will see the StartDate and EndDate being filled with 01-02-10 and 28-02-10.

I use this code to place a date filter in a table: the user inputs the month and this code allows me to create the range of dates correspondent to that month.

Just play with it and see if you can change it to match your needs.

ok… thanks Jose Monteiro

I will try it…