Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need a dialog box to all a user to add 3 different pieces of data

Status
Not open for further replies.

jeaneshe

Programmer
May 1, 2013
19
US
Does someone have a simple bit of code that encompasses running a dialog box with only labels and textbox inputs in a macro? I'm not sure why I'm having such a problem, but sometimes the simplest things get lost in the trees.
Here is the form. I don't know how to call it from the macro or how to obtain the text values. Actually, I think if I could call it I can figure out how to get the values. Please help....
 
hi,

Your code please.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Option Explicit


Private Sub CommandButton1_Click()

End Sub

Private Sub CommandButton2_Click()

End Sub

Private Sub Label1_Click()

End Sub

Private Sub Label2_Click()

End Sub

Private Sub textBox1_Change()

End Sub

Private Sub TextBox2_Change()

End Sub

Private Sub TextBox3_Change()

End Sub

Private Sub UserForm_Click()

End Sub
 
I don't know how to call it from the macro
Load UserForm1
UserForm1.Show

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Ok.... I used the suggested form loads in my main code block:

Load UserForm1
UserForm1.Show

It appears to work. Then I went to the form and wrote the code under the clicked event.

Private Sub CommandButton1_Click()
Dim entIdTp As String
Dim entIdNum As String
Dim entOcc As String

User will enter data in the textboxes, I capture that with in the variables.
entIdTp = textBox1.Text
entIdNum = TextBox2.Text
entOcc = TextBox3.Text

I then unloaded the form to close it:
Unload UserForm1
End Sub

Are the variable values available to the project once I unload the form? Or do I have to call

something like CommandButton1_Click(entId, entIdNum, entOcc)?

Thank you for helping!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top