Centering text vertically

P

Phil Hageman

In a label or text box control, is it possible to vertically center text?

Thanks, Phil
 
R

Rick B

Sure. in design view, highlight the control and click the "center" button
in the buttons at the top of your screen.

Or open the property box for the control and set the "Text Align" property
to "center".
 
P

Phil Hageman

Hi Rick,

Thanks for your reply. The "center" property centers text horizontally.
What I want to do is center vertically - similar to Excel: Format > Cells >
Align > Vertical > Center.

Phil
 
R

Rick B

Sorry, misread that.

--
Rick B



Phil Hageman said:
Hi Rick,

Thanks for your reply. The "center" property centers text horizontally.
What I want to do is center vertically - similar to Excel: Format > Cells

Align > Vertical > Center.

Phil
 
P

Phil Hageman

Thanks Duane. I inserted a module and copied in the code, and copied in the
code behind the report. But can't figure out how to target a label/text box
and execute the code - which would center the text in the selected control.
 
P

Phil Hageman

Duane, Never mind my last. The target controls are declared in the code and
the code operates on open. Works great! Thanks for the help.
 
P

Phil Hageman

Duane, Label centering works fine, but the text box doesn't. For example,
I have a field named "Strategy Statement," which was inserted (dragged) into
the report from the Field List. The Label centers, the text portion doesn't.
How do I code the text portion to make it center? Note: field names do have
spaces and I will have to accept that, so the code would have to accomodate
that too.

Phil
 
D

Duane Hookom

If Stephen doesn't reply then consider beginning a new thread with an
accurate description of what you have set up and what you are experiencing.
 
S

Stephen Lebans

I would guess off the top of my head that the space chars contained in
his control names are the issue here. The OP needs to enclose his full
control name within SQUARE brackets as each call is made to the
VerticallyCenter subroutine.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
P

Phil Hageman

Steve,
I have removed all spaces from all tables. Then, in the code for the
report, in the following subs: Private Sub Detail_Format... and Private Sub
Report_Open... , I have coded the following:

VerticallyCenter Me.Label3
VerticallyCenter Me.txtStrategyName (field names were verified correct)

This field was dragged to the report from the field list, and I grouped them
in the code this way for clarity. In this example (L3/SN), centering does
not work for either case. Also, I get a compile error: "Member or data
member not found," with .txtStrategyName highlighted.

Strangely, there are two other Labels centering properly.

Any idea where my error is?

Thanks, Phil
 
S

Stephen Lebans

All I can do is refer you back to the setup and code behind the sample
Report in the MDB you downloaded.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Top