How does it not worK?
lparameter tcFormName
if vartype(tcFormName) <> "C"
return .null.
endif
tcFormName = alltrim(upper(tcFormName))
if empty(tcFormName)
return .null.
endif
local lnI, loForm
loForm = .null.
for lnI = 1 to _screen.formcount
if upper(_screen.forms[lnI].name) == tcFormName
loForm = _screen.forms[lnI]
exit
endif
endfor
return loForm
Returning loForm returns an object reference to the form you are looking for. Now you can get any any information about that form, its DE, etc., you want.
>The _screen.* option did not work. I did notice that each session is named and it would be ideal to select datasessions by name instead of numbered ID. Since I am working with a multi-window environment there is no set numbered order assigned to each session, the numbering order is set in the order that each form is open.
>
>The only other option I see is to step through each session to check for the needed table that I am looking for, and then handle any errors due to an invalid datasession number.
>
>Is there any other way of setting a datasession based on the datasession name?
>
>Thank you in advance.
>
>Alex Rodriguez
Mark McCasland
Midlothian, TX USA