>hi,
>can i place two field in one grid, while both the field are from different table, but they do have relation between them. Set the ControlSource of the column to the lookup function.
Yes, you can, but sometimes you may have trouble with information not being refreshed immediately. To avoid this, I often use a lookup function for this purpose (see below).
Another alternative is to use a view on both tables.
My lookup function:
FUNCTION MyLookup(tcAlias, tcOrder, txSeekValue, tcReturnValue, tlEmptyValues)
local lnSelect, llFound, lcAlias
lnSelect = select()
lcAlias = tcAlias + "_mylookup"
if not used(lcAlias)
use (tcAlias) again alias (lcAlias) in 0
endif
select (lcAlias)
set order to (tcOrder)
llFound = iif(isnull(txSeekValue), .F., seek(txSeekValue))
local lxReturnValue
lxReturnValue = eval(tcReturnValue)
if not (llFound or tlEmptyValues)
lxReturnValue = NULL
endif
select (lnSelect)
return lxReturnValue
ENDFUNC
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)