Solved

How to right justify a column in a multi-column text box

Posted on 2015-02-02
8
168 Views
Last Modified: 2015-02-05
I need to right-justify a currency formatted column in a text box containing a number of columns.  How is this done?
0
Comment
Question by:David_W_R
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 200 total points
Comment Utility
I've never heard of a multi-column textbox, do you mean a list-box?

List boxes always format the data as text strings, and automatically line up to the left of each column.  When I want to display numeric values, right justified in a listbox, I use a non-proportional font, and pad the left side of the string, something like:

Right(Space(10) & [SomeField], 10)
0
 
LVL 34

Assisted Solution

by:PatHartman
PatHartman earned 100 total points
Comment Utility
I do it this way - which probably has the same effect as what Dale suggested so no points please unless this works and his doesn't.  I chose 12 as the width of the output field.  That gives extra room for the $ and commas and decimal.
Space(12 - Len(SomeField)) & SomeField
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 200 total points
Comment Utility
If you do not need non-contiguous selections, (or if you just need to display these values), ...You may opt to use a small datasheet view subform
You will have to set the AllowEdits, AllowDeletions, and AllowAdditions, Properties all to NO
It will look something like this:
Subform...and the the Currency values will display in their native, Right Justified position...

JeffCoachman
0
 

Author Closing Comment

by:David_W_R
Comment Utility
I really appreciate the insight from each answer.  I think I'll use the datasheet to take advantage of the Access automatic formatting of currency.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
Comment Utility
Yeah, I should have mentioned that I have started using a lot more datasheets instead of listboxes because of their versatility.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Dave,
Yep, , it all depend on what you need.
If you had needed non-contiguous selects, you would not have been able to use the datasheet view.

Each approach will have advantages and disadvantages.
;-)

Jeff
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
Comment Utility
When I need non-contiguous selects, I simply add a Yes/No column to the mix and allow the user to "check the box".

Dale
0
 

Author Comment

by:David_W_R
Comment Utility
I certainly appreciate the follow-up comments.  Thanks again all.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now