>How can I use function as a recordsource in grid (for example recordsource sholuld be function(table.field) )?
You can do that for grid columns;
Simply enclose it in small bracket when entering column controlsource
( myFunc(datetime()) )
But this will not work on grid record source if this is what you wanted.
Any time grid recourdsource is changed all column settings are lost, underlying cursor for grid is closed, grid goes white etc.
So if you need your grid being set at run time it is better idea to build it from scratch in some form method.
HTH
Sergio