Solved

Concatenate text box value in a command button caption

Posted on 2008-10-24
4
342 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 119

Assisted Solution

by:Rey Obrero
Rey Obrero 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now