ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Text Box not showing inputted value (https://www.excelbanter.com/excel-programming/425643-text-box-not-showing-inputted-value.html)

Jacy Erdelt[_2_]

Text Box not showing inputted value
 
I am trying to initialise a form. I would like it clear all the text boxes,
except the last one should be popluated with "Yes" (but the user can enter
whatever info is appropriate is "yes" is not). The set.focus command works,
but the last box is still empty. What am I doing wrong?

Private Sub EnterNewConsult_Initialize()

txtStore.Value = ""

txtCustomerName.Value = ""

txtClosed.Value = "yes"

txtStore.SetFocus

End Sub

JLGWhiz

Text Box not showing inputted value
 
Change this:

Private Sub EnterNewConsult_Initialize()

To this:

Private Sub UserForm_Initialize()

It does not recognize the UserForm name for the Initialize event, It has to
be the constant provided by microsoft.

"Jacy Erdelt" wrote:

I am trying to initialise a form. I would like it clear all the text boxes,
except the last one should be popluated with "Yes" (but the user can enter
whatever info is appropriate is "yes" is not). The set.focus command works,
but the last box is still empty. What am I doing wrong?

Private Sub EnterNewConsult_Initialize()

txtStore.Value = ""

txtCustomerName.Value = ""

txtClosed.Value = "yes"

txtStore.SetFocus

End Sub


ryguy7272

Text Box not showing inputted value
 
Try this:
Private Sub cmdNewPT_Click() 'my CommandButton is named 'cmdNewPT'...change
this to match the name of your button!!
Dim C As MSForms.Control
For Each C In Me.Controls
If TypeOf C Is MSForms.TextBox Then
C.Text = ""
End If
Next C
End Sub

Regards,
Ryan---
--
RyGuy


"JLGWhiz" wrote:

Change this:

Private Sub EnterNewConsult_Initialize()

To this:

Private Sub UserForm_Initialize()

It does not recognize the UserForm name for the Initialize event, It has to
be the constant provided by microsoft.

"Jacy Erdelt" wrote:

I am trying to initialise a form. I would like it clear all the text boxes,
except the last one should be popluated with "Yes" (but the user can enter
whatever info is appropriate is "yes" is not). The set.focus command works,
but the last box is still empty. What am I doing wrong?

Private Sub EnterNewConsult_Initialize()

txtStore.Value = ""

txtCustomerName.Value = ""

txtClosed.Value = "yes"

txtStore.SetFocus

End Sub


JLGWhiz

Text Box not showing inputted value
 
Huh? Ryan, are you on the correct thread?

"ryguy7272" wrote:

Try this:
Private Sub cmdNewPT_Click() 'my CommandButton is named 'cmdNewPT'...change
this to match the name of your button!!
Dim C As MSForms.Control
For Each C In Me.Controls
If TypeOf C Is MSForms.TextBox Then
C.Text = ""
End If
Next C
End Sub

Regards,
Ryan---
--
RyGuy


"JLGWhiz" wrote:

Change this:

Private Sub EnterNewConsult_Initialize()

To this:

Private Sub UserForm_Initialize()

It does not recognize the UserForm name for the Initialize event, It has to
be the constant provided by microsoft.

"Jacy Erdelt" wrote:

I am trying to initialise a form. I would like it clear all the text boxes,
except the last one should be popluated with "Yes" (but the user can enter
whatever info is appropriate is "yes" is not). The set.focus command works,
but the last box is still empty. What am I doing wrong?

Private Sub EnterNewConsult_Initialize()

txtStore.Value = ""

txtCustomerName.Value = ""

txtClosed.Value = "yes"

txtStore.SetFocus

End Sub


ryguy7272

Text Box not showing inputted value
 
I read clear all the text boxes'. I forgot about the part about the 'last
one should be popluated with "Yes"'. My code clears all text boxes; I use
the code occasionally and it works great. What did I miss?

Thanks,
Ryan---

--
RyGuy


"JLGWhiz" wrote:

Huh? Ryan, are you on the correct thread?

"ryguy7272" wrote:

Try this:
Private Sub cmdNewPT_Click() 'my CommandButton is named 'cmdNewPT'...change
this to match the name of your button!!
Dim C As MSForms.Control
For Each C In Me.Controls
If TypeOf C Is MSForms.TextBox Then
C.Text = ""
End If
Next C
End Sub

Regards,
Ryan---
--
RyGuy


"JLGWhiz" wrote:

Change this:

Private Sub EnterNewConsult_Initialize()

To this:

Private Sub UserForm_Initialize()

It does not recognize the UserForm name for the Initialize event, It has to
be the constant provided by microsoft.

"Jacy Erdelt" wrote:

I am trying to initialise a form. I would like it clear all the text boxes,
except the last one should be popluated with "Yes" (but the user can enter
whatever info is appropriate is "yes" is not). The set.focus command works,
but the last box is still empty. What am I doing wrong?

Private Sub EnterNewConsult_Initialize()

txtStore.Value = ""

txtCustomerName.Value = ""

txtClosed.Value = "yes"

txtStore.SetFocus

End Sub


JLGWhiz

Text Box not showing inputted value
 
I think it will work OK if he uses the correct syntax for the
UserForm_Initialize event. I thought you had posted to the wrong thread.

"ryguy7272" wrote:

I read clear all the text boxes'. I forgot about the part about the 'last
one should be popluated with "Yes"'. My code clears all text boxes; I use
the code occasionally and it works great. What did I miss?

Thanks,
Ryan---

--
RyGuy


"JLGWhiz" wrote:

Huh? Ryan, are you on the correct thread?

"ryguy7272" wrote:

Try this:
Private Sub cmdNewPT_Click() 'my CommandButton is named 'cmdNewPT'...change
this to match the name of your button!!
Dim C As MSForms.Control
For Each C In Me.Controls
If TypeOf C Is MSForms.TextBox Then
C.Text = ""
End If
Next C
End Sub

Regards,
Ryan---
--
RyGuy


"JLGWhiz" wrote:

Change this:

Private Sub EnterNewConsult_Initialize()

To this:

Private Sub UserForm_Initialize()

It does not recognize the UserForm name for the Initialize event, It has to
be the constant provided by microsoft.

"Jacy Erdelt" wrote:

I am trying to initialise a form. I would like it clear all the text boxes,
except the last one should be popluated with "Yes" (but the user can enter
whatever info is appropriate is "yes" is not). The set.focus command works,
but the last box is still empty. What am I doing wrong?

Private Sub EnterNewConsult_Initialize()

txtStore.Value = ""

txtCustomerName.Value = ""

txtClosed.Value = "yes"

txtStore.SetFocus

End Sub


ryguy7272

Text Box not showing inputted value
 
I think so too, but I don't know for sure. I'm still learning this stuff
myself! I know if it works, it works, and if it doesn't work I try to figure
out how to make it work.

So, what's the verdict Jacy?

Ryan--



--
RyGuy


"JLGWhiz" wrote:

I think it will work OK if he uses the correct syntax for the
UserForm_Initialize event. I thought you had posted to the wrong thread.

"ryguy7272" wrote:

I read clear all the text boxes'. I forgot about the part about the 'last
one should be popluated with "Yes"'. My code clears all text boxes; I use
the code occasionally and it works great. What did I miss?

Thanks,
Ryan---

--
RyGuy


"JLGWhiz" wrote:

Huh? Ryan, are you on the correct thread?

"ryguy7272" wrote:

Try this:
Private Sub cmdNewPT_Click() 'my CommandButton is named 'cmdNewPT'...change
this to match the name of your button!!
Dim C As MSForms.Control
For Each C In Me.Controls
If TypeOf C Is MSForms.TextBox Then
C.Text = ""
End If
Next C
End Sub

Regards,
Ryan---
--
RyGuy


"JLGWhiz" wrote:

Change this:

Private Sub EnterNewConsult_Initialize()

To this:

Private Sub UserForm_Initialize()

It does not recognize the UserForm name for the Initialize event, It has to
be the constant provided by microsoft.

"Jacy Erdelt" wrote:

I am trying to initialise a form. I would like it clear all the text boxes,
except the last one should be popluated with "Yes" (but the user can enter
whatever info is appropriate is "yes" is not). The set.focus command works,
but the last box is still empty. What am I doing wrong?

Private Sub EnterNewConsult_Initialize()

txtStore.Value = ""

txtCustomerName.Value = ""

txtClosed.Value = "yes"

txtStore.SetFocus

End Sub


JLGWhiz

Text Box not showing inputted value
 
One reason I don't rewrite the code for the OP except in certain conditions
is that i don't think they learn too much when I give them tight code. Not
that mine is all that tight, but based on my own experience, I learned a lot
faster and it stayed with me longer when I had to struggle with it for a
while. I usually try to throw in a little explanation with the suggestions
where it looks like it is needed.

"ryguy7272" wrote:

I think so too, but I don't know for sure. I'm still learning this stuff
myself! I know if it works, it works, and if it doesn't work I try to figure
out how to make it work.

So, what's the verdict Jacy?

Ryan--



--
RyGuy


"JLGWhiz" wrote:

I think it will work OK if he uses the correct syntax for the
UserForm_Initialize event. I thought you had posted to the wrong thread.

"ryguy7272" wrote:

I read clear all the text boxes'. I forgot about the part about the 'last
one should be popluated with "Yes"'. My code clears all text boxes; I use
the code occasionally and it works great. What did I miss?

Thanks,
Ryan---

--
RyGuy


"JLGWhiz" wrote:

Huh? Ryan, are you on the correct thread?

"ryguy7272" wrote:

Try this:
Private Sub cmdNewPT_Click() 'my CommandButton is named 'cmdNewPT'...change
this to match the name of your button!!
Dim C As MSForms.Control
For Each C In Me.Controls
If TypeOf C Is MSForms.TextBox Then
C.Text = ""
End If
Next C
End Sub

Regards,
Ryan---
--
RyGuy


"JLGWhiz" wrote:

Change this:

Private Sub EnterNewConsult_Initialize()

To this:

Private Sub UserForm_Initialize()

It does not recognize the UserForm name for the Initialize event, It has to
be the constant provided by microsoft.

"Jacy Erdelt" wrote:

I am trying to initialise a form. I would like it clear all the text boxes,
except the last one should be popluated with "Yes" (but the user can enter
whatever info is appropriate is "yes" is not). The set.focus command works,
but the last box is still empty. What am I doing wrong?

Private Sub EnterNewConsult_Initialize()

txtStore.Value = ""

txtCustomerName.Value = ""

txtClosed.Value = "yes"

txtStore.SetFocus

End Sub



All times are GMT +1. The time now is 03:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com