Suppose you have a form A that calls form B.
In Form B you want to know what is the data source of Form A and if it’s a VendTable you wish to retrieve the AccountNum field
VendTable vendTableLocal;
switch (element.args().record().dataSource().Name())
{
case 'VendTable':
vendTableLocal = element.args().record() as VendTable;
break;
default:
break;
}