Solved

Concatenate text box value in a command button caption

Posted on 2008-10-24
4
345 Views
Last Modified: 2013-11-28
Is it possible to capture the value of a text box (text box data type is text)  and concatenate this to the caption in a command button?
If I have a text box with the value 1234 and I want a command button to concatenate this value in a command button caption saying Print Unit 1234 report is this possible. I tried several way and cant make it work, is this not allow in Access VBA?
0
Comment
Question by:Exl04
  • 2
4 Comments
 
LVL 1

Expert Comment

by:SIGLR-Guy
ID: 22796158
You have to set the button's caption by code, after the lost focus event of the text box.
0
 
LVL 1

Accepted Solution

by:
SIGLR-Guy earned 250 total points
ID: 22796179
I was talking about th lost focus event in case you actually allow the text field to be edited. But otherwise, you need to identify the event you want to use (one that fires after the text has been set in the field) to then change the button's caption through code.

Hope this helps.
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 250 total points
ID: 22796289
you can use the textbox afterupdate event

private sub textboxName_afterupdate()

me.commandbuttonname.caption="Print Unit " & me.textboxname & " report"

end sub
0
 
LVL 1

Author Closing Comment

by:Exl04
ID: 31623604
Thank you guys! both where correct
Thanks for let me learn from you guys.
IgnBan
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

774 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