Access text box concatination

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]) &
Who is Participating?
SeanStricklandConnect With a Mentor Commented:
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

="Anticipated Equity:" & Sum([CurrentAnticipatedInvestment])
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
clarkscottConnect With a Mentor Commented:
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
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.