• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 350
  • Last Modified:

Concatenate text box value in a command button caption

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
Exl04
Asked:
Exl04
  • 2
2 Solutions
 
SIGLR-GuyCommented:
You have to set the button's caption by code, after the lost focus event of the text box.
0
 
SIGLR-GuyCommented:
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
 
Rey Obrero (Capricorn1)Commented:
you can use the textbox afterupdate event

private sub textboxName_afterupdate()

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

end sub
0
 
Exl04Author Commented:
Thank you guys! both where correct
Thanks for let me learn from you guys.
IgnBan
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now