procedure mLaunchForm lparameters cFormToOpen * set class library if not already set if "pogo_classes" $ set('classlib') else set classlib to pogo_classes additive endif * set value of pOpenFormCount to the number of columns in aForms this.pOpenFormCount = alen(this.aForms, 1) * set lnCount minus 1 for actual array locations that could hold forms lnCount = this.pOpenFormCount - 1 * check if it's the first ever form if this.pOpenFormCount = 1 * create and show the form this.aForms[this.pOpenFormCount] = createobject(cFormToOpen) this.aForms[this.pOpenFormCount].show() * re-dimension the form to allow for new forms to be added dimension this.aForms[this.pOpenFormCount + 1] * increase the pOpenFormCount value this.pOpenFormCount = this.pOpenFormCount + 1 * if first form already exists - check if form is alreadu open else for lnLoop = 1 to lnCount * ignore any null or logical value arrays if isnull(this.aForms[lnLoop]) or type('this.aForms[lnLoop]') = 'L' else * check for form name amongst the open forms if this.aForms[lnLoop].name = (cFormToOpen) this.lnFormFound = .t. * form is found so exit after setting lnFormFound .t. exit else * if form is not found this.lnFormFound = .f. endif endif endfor * check value of lnFormFound if this.lnFormFound * form was found so zoom - show - refresh zoom window (this.aForms[lnLoop].name) norm this.aForms[lnLoop].show() this.aForms[lnLoop].refresh() else * form wasn't found so it doesn't exist - create it * loop used to find the first avaliable array location for lnLoop = 1 to lnCount * if null or logical is found - create the form if isnull(this.aForms[lnLoop]) or type('this.aForms[lnLoop]') = 'L' this.aForms[lnLoop] = createobject(cFormToOpen) this.aForms[lnLoop].show() else * no spare locations - adding the form to the end this.aForms[this.pOpenFormCount] = createobject(cFormToOpen) this.aForms[this.pOpenFormCount].show() endif * form has been added so exit the loop exit endfor * re-dimension the array so that new forms can be added dimension this.aForms[this.pOpenFormCount + 1] endif endif endproc * End of mLaunchForm procedureSorry it's so long but I don't know how then to refer to the form that is oApp.TopForm to get it to work with .queryunload?