Automation, Printing Tables, and column width

  • Thread starter Thread starter JohnB
  • Start date Start date
J

JohnB

Hi,
I have written a program using C# to print out Access
Tables.
It is fairly trivial. I select the table then print.
oAccess.DoCmd.SelectObject
(Access.AcObjectType.acTable,table,true);

oAccess.DoCmd.PrintOut
(Access.AcPrintRange.acPrintAll,Missing,Missing,Access.AcP
rintQuality.acHigh,1,false);

I have encounterd a few bugs that I need to address, and
was hoping this group could assist me.

The first question I have is how can I make access
automatically set the width of the columns so that
records don't get cut off?

Also, if a table contains no data I would still like to
be able to see all the column names. This does not seems
to happen. Access will only print as many columns that
it can fit on to one page. How do I fix this?
Thanks,
JohnB
 
John:

In a nutshell, managing the column width of tables via code etc; is a night
mare. You shoud rather create simple report which provides you fine grain
control over control width (which you can't change in code easily their
either, but, you can set a control's property to CanGrow which will allow it
to expand downward if data exceeds its width, resulting in at least getting
all the data displayed.) Then use the docmd.OpenReport method to output
the data.
 
Back
Top