&& you should check that thisform.oCurrentControl exists first... thisform.oCurrentControl = thisThen in rightClick() method of the commandbutton:
if vartype(thisform.oCurrentControl) = "O" && also, check out PEMStatus(), getPEMStatus(), && you may want to call it to make sure the setfocus() && method really exists...although it shouldn't be && necessary if the only place that sets oCurrentControl to && an object is an object that has setfocus() thisform.oCurrentControl.setfocus() endifThis is just the basic concept; you will have to work with a little to make it bulletproof for all situations.