Calling the curren record through dialog in ax2009

Hi all,

There is a standard form, from that am clicking the menubutton this will call a class through which one dialog will get open in dialog am entering the from date & to Date if i click OK in dialog another new form will get open in that form the from & to date will get insert but for the second record when i do the same, it is opening with the previous record and the second record which i enter will show in that form.

But i want when i open 2nd or for any other record throuth that dialog i need to open only that current record data should get displayed not the previous record should show i that form.

But in the standard and new for ther is a sanme field called refid.

But my question is how to filter the current record while opening through the dialog.

Thanks in advance.