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]) &
PhereklosAsked:
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
0
 
SeanStricklandCommented:
Try:

="Anticipated Equity:" & Sum([CurrentAnticipatedInvestment])
0
 
clarkscottCommented:
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
 
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
0
 
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.

mx
0
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.