?
Solved

Access text box concatination

Posted on 2008-11-18
5
Medium Priority
?
289 Views
Last Modified: 2013-11-28
Real simple question.  I have a text box that sums money raised for projects.  I'd like to incorporate the label element into the text box.  My reason for this is only aesthetic--I want the full line of text to be centered, and this is not possible using a label/text box combination.  Here is what I've tried, and clearly it does not work.

="Anticipated Equity:" & Sum([CurrentAnticipatedInvestment]) &
0
Comment
Question by:Phereklos
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:SeanStrickland
ID: 22985189
Try:

="Anticipated Equity:" & Sum([CurrentAnticipatedInvestment])
0
 
LVL 20

Expert Comment

by:clarkscott
ID: 22985202
You can place this in a label or text box.  If you don't want both, eliminate one of them
Make sure you have access to CurrentAnticipatedInvestment value.

me.label.caption ="Anticipated Equity:" & Sum([CurrentAnticipatedInvestment])
or me.txbox = "Anticipated Equity:" & Sum([CurrentAnticipatedInvestment])

In design mode - center the text (either label or textbox).

Scott C
0
 
LVL 11

Accepted Solution

by:
SeanStrickland earned 800 total points
ID: 22985248
To clarify for you, Phereklos...

The solution that I provided would mean that you alter what you already have in the control source of your text box.  The solution that Scott provided would be utilized in your VBA code via, most likely, the Form_Load() event.

Private Sub Form_Load()
 Me.Label0.Caption = "Anticipated Equity: " & Sum([CurrentAnticipatedInvestment])
 Me.Text0 = "Anticipated Equity: " & Sum([CurrentAnticipatedInvestment])
End Sub
0
 
LVL 20

Assisted Solution

by:clarkscott
clarkscott earned 800 total points
ID: 22985417
In addition to Sean....

The Form  CURRENT event would be where this is placed.

Actually, if you use a text box and put the code right in the control source it will work (right from the textbox).

=Anticipated Equity: " & Sum([CurrentAnticipatedInvestment])

(don't forget the "=" sign)
and CurrentAnticipatedInvestment must be on the form (I think - even if it's visible = false)

Scott C
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 400 total points
ID: 22986440
IF ... CurrentAnticipatedInvestment is the name of another text box (??), you cannot Sum() on controls, only the name if Fields in the underlying record source.  If this IS the name of a field, then what was first posted should work.

mx
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

850 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