>Thanks but that does not work either. Maybe it's best to add more information.
>
>I'm working with AccountMate LAN 505. From the menu I open a formset and make the main form active. But I want only one instance of the formset to be active (single instance). So in the init of the formset I look for another main form. But your code and my code closes it's self even it's the first form. I'll try the load of the formset.
>TIA
>John
John,
I never worked with formsets but basically they're forms too. Initialize your formset with a name clause and check if exists and !isnull.
ie:
if type('oApp.frmBrds')='O' and !isnull(oApp.frmBrds)
oApp.frmBrds.Show()
else
do form myFormSet name oApp.frmBrdms
endif
Or as you do with _screen.forms looping :
local ix,loForm,llExists
for ix=1 to _screen.forms.count
loForm = _screen.Forms(m.ix)
if upper(loForm.Name) == "BRDMS"
loForm.Show
llExists = .t.
exit
endif
endfor
if !llExists
do form BRDMS
endif
PS: If you're doing the check in the init then it'd count itself too. In that case return .f. from init.
Cetin