I have a form which works fine at the moment but I've been trying to reduce the amount of code. Depending upon the type of claim there can be many different types of input required. In the past I've caught the choices in code but I thought it would be easier maintenance- wise to put them in a table. I have a character field (called 'picker') in a master table with the names of the fields necessary for a particular claim. By selecting the type of claim I want to produce a grid with the minimum of fields.
I want to duplicate what I have now: the user just clicks on the appropriate field and a text or combo box pops up with the right controlsource.
I produce the grid correctly with the proper headings but am having trouble getting the right controlsource for each of the fields. The controlsource name will be the same as the header. Even when it looks as though the code has worked it seems to be taking just the fields in numeric order.
Would appreciate any help.
Many thanks
rgw
thisform.grid_new_status.recordsource='status'
For X=1 To moccur
MLEN=Len(Alltrim(mpicker))
mpos=At(',', mpicker)
MFIELD=Substr(mpicker,1,mpos-1)
mpicker=Substr(mpicker,mpos+1, MLEN-mpos)
With Thisform.grid_nEW_STATUS
.Columns(x).header1.Caption='&mfield'
.Columns(X).header1.Alignment=2
.columns(x).readonly=.T.
.columns(x).fontsize=12
.columns(x).fontname='Verdana'
.columns(x).header1.fontsize=12
.columns(x).controlsource='&mfield'
ENDWITH
Endfor
I want to duplicate what I have now: the user just clicks on the appropriate field and a text or combo box pops up with the right controlsource.
I produce the grid correctly with the proper headings but am having trouble getting the right controlsource for each of the fields. The controlsource name will be the same as the header. Even when it looks as though the code has worked it seems to be taking just the fields in numeric order.
Would appreciate any help.
Many thanks
rgw
thisform.grid_new_status.recordsource='status'
For X=1 To moccur
MLEN=Len(Alltrim(mpicker))
mpos=At(',', mpicker)
MFIELD=Substr(mpicker,1,mpos-1)
mpicker=Substr(mpicker,mpos+1, MLEN-mpos)
With Thisform.grid_nEW_STATUS
.Columns(x).header1.Caption='&mfield'
.Columns(X).header1.Alignment=2
.columns(x).readonly=.T.
.columns(x).fontsize=12
.columns(x).fontname='Verdana'
.columns(x).header1.fontsize=12
.columns(x).controlsource='&mfield'
ENDWITH
Endfor