>if vartype(_Screen.ActiveForm) = "O" ; > and pemstatus(_Screen.ActiveForm,"BaseClass",5) ; > and upper(_Screen.ActiveForm.BaseClass) = "FORM" then > return _Screen.ActiveForm >else > * use a Do While Loop to cycle through the .Parent properties until you get to an object that's a form > local lotmp > lotmp = _Screen.ActiveForm.Parent > do while .T. > if isnull(lotmp); > or upper(lotmp.BaseClass) = "FORM" then > exit > else > lotmp = iif(vartype(lotmp.Parent) = "O",lotmp.Parent,NULL) > endif > enddo > > return lotmp >endifI'm tired from getting no sleep (broke up with gf), but hopefully I didn't miss something here. You are testing to see if the ActiveForm is an Object. But if not you go ahead and look for the Parent as ActiveForm was an Object. Are you sure it was what you had in mind?