Form - Text box and command button

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

Hi All,

I just want to know if I can get the value in the text box
when a command button is clicked. What I mean is that,
when I enter someting in a text box and press a command
button, that command button takes the value from the text
box and display it in a message. Is it possilbe to do it??
Any suggestion??

Thanks for the help...

mike
 
Mike,
This is a pretty simple task if you are familiar with writing VB code.

Say you have a text box called "MyTextBox".
You make a button, call it whatever you want.
In the properties of the button, go to the "On Click" event. Set the On
Click value to "Event Procedure", then click the elipse (...) button to go
into the area where you write code.
In this code area, you could write the following line of code to display a
message box containing the value in the text box:

msgbox "You entered" & Me.MyTextBox & " in the text field", vbOkOnly, "FYI"

(translation = Display a pop-up message box with the message "You entered
(value entered in MyTextBox) in the text field." The messagebox will be
formatted with only on OK button, and will have the title "FYI".)

Now when you open the form in runtime, you type whatever you want in the
textbox, click the button, and the pop-up message will tell you what you
typed.

Let me know if you need more help.
Andy
(e-mail address removed)
 
Back
Top