以下是引用sdta在2023-3-27 17:42:48的发言:
问题应该在
RecordSource='历史同期统计'
RecordSource='历史'
列数不同造成的
我终于弄清楚,是怎么回事了,上代码
thisform.pageframe1.page1.pageframe1.page1.grid2.setall("alignment",2,"column")&&内容居中
thisform.pageframe1.page1.pageframe1.page1.grid2.setall("alignment",2,"header")&&表头居中
thisform.pageframe1.page1.pageframe1.page1.grid2.setall("resizable",.f.,"column")&&禁止调整宽度
thisform.pageframe1.page1.pageframe1.page1.grid2.setall("movable",.f.,"column")&&禁止调整列前后
thisform.pageframe1.page1.pageframe1.page1.grid2.rowheight=28
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(1).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(2).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(3).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(4).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(5).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(6).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(7).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(8).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(9).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(10).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(11).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(12).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(13).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(14).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(15).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(16).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(17).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(18).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(19).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(20).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(21).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(22).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(23).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(24).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(25).backcolor=RGB(247,247,247)
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(1).width=290
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(2).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(3).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(4).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(5).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(6).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(7).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(8).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(9).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(10).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(11).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(12).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(13).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(14).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(15).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(16).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(17).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(18).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(19).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(20).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(21).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(22).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(23).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(24).width=30
thisform.pageframe1.page1.pageframe1.page1.grid2.Columns(25).width=30
我把这段代码放在了查询按钮里面,就没有问题了,可能是,表格不存在,还没有生成表格前,表格的init里面当然不存在,columns,所以会报错!