setting report control widths

  • Thread starter Thread starter Mike Tobias
  • Start date Start date
M

Mike Tobias

I am trying to allow a user to decide what fields to show
in a report. Eg, they might pick LastName, HomePhone,
State or they might pick LastName, City, State, ZIP.

So I want to set control positions and widths on the fly.
I know I can make controls visible or not, but I haven't
found a way to control either position or width.

Any help would be fantastic. Thanks in advance.
 
Mike said:
I am trying to allow a user to decide what fields to show
in a report. Eg, they might pick LastName, HomePhone,
State or they might pick LastName, City, State, ZIP.

So I want to set control positions and widths on the fly.
I know I can make controls visible or not, but I haven't
found a way to control either position or width.

Any help would be fantastic. Thanks in advance.
Mike,

You can change the controls position & dimension properties
by code. The properties use Twips as a unit of measurement.
There are 1440 Twips in each inch.
In the Report's Detail section Format event:

If Me.[Page] Mod 2 = 0 Then
Me!ControlName.Left = 3 * 1440
Me!ControlName.Top = 0.1 * 1440
Me!ControlName.Width = 1.25 * 1440
Else
Me!ControlName.Left = 1 * 1440
Me!ControlName.Top = 0.5 * 1440
Me!ControlName.Width = 0.5 * 1440
End If

You can use your own criteria to move the control.
Mine above will alter the position and size on each even/odd page.

If you wish to fix it's size and position on the report, depending upon
values selected in a form, you can use code.
In the Report's Report Header Format event:

Me!ControlName.Left = forms!FormName!ControlName1 * 1440
Me!ControlName.Top = forms!FormName!ControlName2 * 1440
Me!ControlName.Width = forms!FormName!ControlName3 * 1440

etc.

The form must be open when the report runs.
 
me.Width = 999
me.Top = 999
me.Left = 999
me.Height =

If you are doing it ouside the control itself, but in the form...
e.g. OnOpen Event
me.Controls(ctlName).Left = 999

Regards Greg Kraushaar
Wentworth Falls Australia
(Do not email - the reply address is a Spam spoofer)
(If you really must, remove all UCase and numbers)
 
Back
Top