Subform Columns

S

Stevo

Hi, I have a subform that is using a temporary table. The temp table is
deleted and repopulated via a query. The trouble is the amount of columns can
vary. Unfortunately the subform still shows the columns from the last time
the temp table was created. Is there a way that the subform can be refreshed
to show ONLY the columns that are in the temp table?
 
E

Erez Mor

hi
one way you can achive this is programaticaly show/hide the textboxes in the
subform according to the number of fields(columns) in the underlying table:
you have to know the maximum number of possible columns and have the subform
fit that - give the textboxes repetitive names like text1, text2....
then, in the event of rebuilding the subfom/table:
hide all the textboxes
for x=1 to 10
me.controls("text" & x).visible=false
next x

and then, using a:
x=1
for each fld in [underlying table] fields
me.controls("text" & x).controlsource=fld.name
me.controls("text" & x).visible=true
x=x+1
next fld

you bind and display only the amount of textboxes you need

hope it all made sense
Erez.
 
Top