Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Centering Text in List Box 1

Status
Not open for further replies.

EllieFant

MIS
May 15, 2001
513
0
0
US
Can I format how text appears in a List Box? I have a list of Departments which are aligned left (which is great) and a list of numbers that are also aligned left that I would like to have aligned right.

Can this be done?
Ellie
**Using Access 97 at work**
**Using Access 2000 at home**

lena.wood@starband.net
 
Hi,

its pretty simple, open the form in design view and select your text box. There should be a font tool bar displayed on the screen. Click the button that has several lines centered (this should be next to the font bold/underline/italics buttons) to have the textbox display the text as centered. You can also click on the other 2 buttons to left/right align text. If you don't see a font toolbar go to "View" - "Toolbars" - "Formatting (Forms/Reports)". Hope this helps,

jbehrne
 
Those buttons are greyed out. That was my first thought.

thanks for trying :) Ellie
**Using Access 97 at work**
**Using Access 2000 at home**

lena.wood@starband.net
 
Hi,

Hmmm... Try this instead. Open your form in design view. Right click on your text box and go to "Properties". Click the tab labeled "Format". Find the field labeled "Text Align". Clicking in the field will bring down a menu where you can manually set the alignment. Just make sure you save your form when you close it. Let me know if this works,

jbehrne
 
jbehrne, I believe the field in question is not a textbox, it's a listbox. And the TextAlign property is not available for a listbox control (even though the VBA help file says that the TextAlign property applies to the listbox object). It's grayed out on the format toolbar, it's not available on the field's property sheet, and trying to set the property with code causes an error message. Maybe there's a way to do it, but I haven't found it yet.

Ellie, depending on how you want to use the listbox and how important the alignment is, you might be able to replace it with a subform based on the same recordsource as your listbox. You could display the subform in datasheet view or design your form so there is no extraneous space above or below the fields, then display it as continuous forms.

Ken S.
 
It would appear that you're right about Text Align not being available for a listbox; it certainly does LOOK like it's available though. It is:

1) Not grayed out on the Format toolbar (in my version)

2) Available in the property box (in my version)

3) In design view when you use either # 1 or # 2 above to set it, say to Right Align, it does indicate that it's been set to Right Align (the control label that appears in Design View moves to the right side of the listbox control)

So although everything indicates that the text is aligned however you've arranged it, it's always Left Aligned when you run the form. My guess is you'd have to chalk it up to "just one of those Access things"!

The Missinglinq "It's got to be the going,
not the getting there that's good!"
-Harry Chapin
 
Hi,

Sorry for the confusion, I was thinking of text boxes! DOHHH! :) I did finally track down what is going on though. The text align has been removed from the listbox in Access 2002. I don't know if its available in earlier versions. For info on the Access 2002 check out this link:


jbehrne
 
Yes, I should have specified, I'm running Access 2002 and the textalign property is not available for listbox controls in this version (I guess the help files haven't quite caught up yet).

Ken S.
 
If my boss wants the numbers lined up I will make a continous form to do it. What I am doing is creating a form (with subforms) of different statistics regarding our Security Clearances so all the fields are locked and can't be altered (although they couldn't because they information is from a grouped query).

I really do appreciate all the input. I really do love this list!
 
So the TextAlign property WAS available in Access 2000; it just didn't work! So instead of fixing this deficiency in Access2002, Microsoft simply chose to make it unavailable!

I've been a big defender of Microsoft for years, but Billy Bob Gates (I guess it should be Billy Hank Gates) and his good ol' boys make this position harder to defend with each year.

The Missinglinq "It's got to be the going,
not the getting there that's good!"
-Harry Chapin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top