select distinct cfldname,colHead as clabel, colwidth, readonlyf ; from browflds ; where browflds.cedittype= .editType ; order by nOrder into array aflds nNumflds=_tally select browflds use select bldmstr .bldmstrPF1.page1.BldMstrGrid.columncount=nNumflds && Set the number of columns .bldmstrPF1.page1.BldMstrGrid.recordsourcetype = 1 && NN 03/25/02 .bldmstrPF1.page1.BldMstrGrid.recordsource = 'BldMstr' && NN 03/25/02 for i=1 to nNumflds *-- the next 4 lines use --columns(i)-- instead of macro &thiscol * thiscol='column'+ALLTRIM(STR(i)) && NN 03/25/02 .bldmstrPF1.page1.BldMstrGrid.columns(i).header1.caption=aflds(i,2) && NN 03/25/02 .bldmstrPF1.page1.BldMstrGrid.columns(i).controlsource='bldmstr.'+alltrim(aflds(i,1)) * thefldnum=ASCAN(BMflds,UPPER(ALLTRIM(aflds(i,1)))) && find the index of the field .bldmstrPF1.page1.BldMstrGrid.columns(i).width= aflds(i,3) * Note - we are using pixels here - the foxels results were not good. *!* IF thefldnum<>0 *!* *.bldmstrpf1.page1.BldMstrGrid.&thiscol..WIDTH=BMflds(thefldnum/16+1,3) *!* .bldmstrPF1.page1.BldMstrGrid.&thiscol..WIDTH=((BMflds(thefldnum/16+1,3)*16)/2) && 30 *!* IF BMflds(thefldnum/16+1,3)<LEN(ALLTRIM(aflds(i,2))) *!* .bldmstrPF1.page1.BldMstrGrid.&thiscol..WIDTH=LEN(ALLTRIM(aflds(i,2)))*8 *!* ENDIF *!* IF BMflds(thefldnum/16+1,2) ='I' && Integer *!* .bldmstrPF1.page1.BldMstrGrid.&thiscol..WIDTH=7*10 &&& set to 7 places *!* ENDIF *!* ENDIF .bldmstrPF1.page1.BldMstrGrid.columns(i).alignment=3 * .bldmstrPF1.page1.BldMstrGrid.columns(i).readonly=aflds(i,4) && NSL 1/7/02 Add the readonly property .bldmstrPF1.page1.BldMstrGrid.columns(i).readonly=iif(LEditType= "VIEW",.t.,aflds(i,4)) endfor