How to user GETRECORD?

How do I use GETRECORD function to retrieve the current record shown on the form?

If your code is IN the form, you don’t need to. Just use “Field Name” or “rec” as the record.

If you are in the object that called the form, you need to define a record-variable that is the same type as the tablesource of the form.
After returning from the form, use frmTheForm.GETRECORD(recYourRecord);

Thanks for the reply Kriki. I want to write a codeunit which will capture the data from the form, may be value from a text box or a cell from a table box or matrix box in situations like on running the form for the first time and scrolling the records of the form.

For eg: I would like to write a codeunit which will capture Customer No. from Customer Card form when the Customer card is run for the first time and if the records are scrolled.

Hi NaviKiller, just to add some more information to Kriki’s reply:

his function works after you call RUNMODAL, it does notwork if you use RUN. So your code will be something like
if frmTheForm.RUNMODAL = Action::OK then begin
frmTheForm.GETRECORD(recYourRecord);