ag*********@hotmail.com (A Clark) wrote in message news:<32**************************@posting.google. com>...
I have a subform that displays a datasheet. There are a couple of
different queries that can be displayed in the datasheet. The queries
are available in a combo box on the main form. The problem I am
having is that when I change the query all the column widths remain
the same. This doesn't look very good. I can't figure out a way to
set the column widths.
I have tried..
Subform.controls(Name of Column).columnwidth = IntColumnWidth
However, It doesn't change the width of the column in the subform and
if I debug.print Subform.controls(Name of Column).columnwidth i dont
get a value equal to IntColumnWidth
it just gives me whatever the current width size is.
Thanks for any help.
From the main form I use:
'Code from somewhere on comp.databases.ms-access:
MySubform.Form.MyColumn1.Properties("ColumnWidth") = 1000 '1440 Twips
per inch
MySubform.Form.MyColumn2.Properties("ColumnWidth") = 880
This should allow you to change the Column Widths for the different
queries. I put these commands between the MySubform.Form.Refresh and
the MySubform.Visible = True in my case.
If I use multiple subforms sometimes having a subform with a caption
that simply says "Updating, please wait...." allows me more
flexibility in updating tables via code when bound controls on the
subforms are used. I also like to see if the underlying query results
in any records so that I can show something more interesting than a
blank line.
Also, be aware that if you decide to convert your database containing
subforms to VB you may have to get creative.
James A. Fortune