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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


="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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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)Database Architect / Systems AnalystCommented:
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.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.