问题描述
错误提示英文是"Targetframeisancestorofscriptobject"操作环境:cs模式开发的库,采用帧结构集,在帧结构集的右边的帧结构中一个视图中的按钮中写lotusscript,当运行时,经常会提示:错误提示英文是"Targetframeisancestorofscriptobject"。代码:'全集团的实际分布,所有的PBC完成审批后才能统计'20080709'Msgbox"agentbegin"DimwsAsNewNotesUIWorkspaceDimsAsNewNotesSessionDimdbAsNotesDatabaseDimdocAsNotesDocumentDimdlgdocAsNotesDocumentDimtempdocAsNotesDocumentDimuidocAsNotesUIDocumentDimviewAsnotesviewDimtempviewAsNotesViewDimvn_PBCPLFUAsNotesViewDimkeystrAsStringDimselectionAsStringDimdcAsNotesDocumentCollectionDimcollstrAsVariantDimdeptcollAsVariantDimiColumnAsIntegerDimrichStyleAsNotesRichTextStyleDimrichTextAsNotesRichTextItemDimstyles(1To11)AsNotesRichTextParagraphStyleDimANumAsInteger'绩效等级为A的PBC数量DimBBNumAsInteger'B+的PBC的数量DimBNumAsInteger'B的数量DimCNumAsInteger'C的数量DimDNumAsInteger'D的数量DimTotalNumAsInteger'全集团PBC总的数量DimAPercentAsVariantDimBBPercentAsVariantDimBPercentAsVariantDimCPercentAsVariantDimDPercentAsVariant'初始化ANumSum=0BBNumSum=0BNumSum=0CNumSum=0DNumSum=0APercentSum=0BBPercentSum=0BPercentSum=0CPercentSum=0DPercentSum=0Setdb=s.CurrentDatabaseSetview=db.GetView("(vn_AllPBCNotCompleted)")'未完成审批的PBCSetdc=view.GetAllDocumentsByKey("%")'Msgbox"未完成的PBC:"'Msgboxdc.CountIfdc.count>0ThenMsgbox"有PBC未完成绩效等级评估,暂不能查看全集团的实际绩效等级分布"ExitSubEndIf'如果全集团所有PBC都已经完成审批,则求出各个绩效等级的数量和百分比Setvn_PBCPLFU=db.GetView("(vn_AllPBCCompleted)")Setdc=vn_PBCPLFU.GetAllDocumentsByKey("%")TotalNum=dc.CountSetdlgdoc=NewNotesDocument(db)dlgdoc.Form="fm_PBCCalssDistribution"Ifdc.Count<>0Then'初始化变量ANum=0BBNum=0BNum=0CNum=0DNum=0'分别求出A、B+、B、C、D的PBC数量和PBC的总数Settempdoc=dc.GetFirstDocumentDoWhileNottempdocIsNothingIftempdoc.PBCClass(0)="A"ThenANum=ANum+1Elseiftempdoc.PBCClass(0)="B+"ThenBBNum=BBNum+1Elseiftempdoc.PBCClass(0)="B"ThenBNum=BNum+1Elseiftempdoc.PBCClass(0)="C"ThenCNum=CNum+1Elseiftempdoc.PBCClass(0)="D"ThenDNum=DNum+1EndIfSettempdoc=dc.GetNextDocument(tempdoc)Loop'求出各个等级所占的百分比IfTotalNum<>0ThenAPercent=ANum/TotalNumBBPercent=BBNum/TotalNumBPercent=BNum/TotalNumCPercent=CNum/TotalNumDPercent=DNum/TotalNumEndIf'为dlgdoc赋值,实际分布汇总dlgdoc.APercent=APercentdlgdoc.BBPercent=BBPercentdlgdoc.BPercent=BPercentdlgdoc.CPercent=CPercentdlgdoc.DPercent=DPercentdlgdoc.ANum=ANumdlgdoc.BBNum=BBNumdlgdoc.BNum=BNumdlgdoc.CNum=CNumdlgdoc.DNum=DNum'Callws.EditDocument(False,dlgdoc,True,,False)'Callws.SetTargetFrame("view")Callws.EditDocument(False,dlgdoc,True,,False)'Setuidoc=ws.EditDocument(False,dlgdoc,True,,False)EndIf