J
jeff
I have searched the forum for an answer to this problem, but have been
unable to find one that works for me.
I have UserForm4 with many textboxes. The problem concerns TextBox6. I
want the user to put a numeric value in TextBox6, and it cannot be
left blank.
I put this in to make sure the value is numeric only. It works fine.
Private Sub TextBox6_KeyPress(ByVal KeyAscii As
MSForms.ReturnInteger)
If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then
KeyAscii = 0
End If
End Sub
For the other part of the problem, I tried putting this in
CommandButton1 code that will input all the TextBox data.
I added this in to make sure the user did not leave TextBox6 blank.
Private Sub CommandButton1_Click()
'OK Add this record
If TextBox6.Value = "" Then
MsgBox "There is NO Value in Textbox 6 "
TextBox6.SetFocus
Else
AddsRecord 'Sub below
End If
This works so far as to give me the message. But, it blanks out all
the textboxes the user filled out before hitting the OK button as if
it were starting over.
What I want is for all the data already entered in to be left alone,
and the focus set on TextBox6 to enter in a value. The user would do
this, then hit the OK button again, and all the data will be copied to
the sheet. I’m sure I’m almost there. Can anyone help??
Thanks
j.o.
unable to find one that works for me.
I have UserForm4 with many textboxes. The problem concerns TextBox6. I
want the user to put a numeric value in TextBox6, and it cannot be
left blank.
I put this in to make sure the value is numeric only. It works fine.
Private Sub TextBox6_KeyPress(ByVal KeyAscii As
MSForms.ReturnInteger)
If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then
KeyAscii = 0
End If
End Sub
For the other part of the problem, I tried putting this in
CommandButton1 code that will input all the TextBox data.
I added this in to make sure the user did not leave TextBox6 blank.
Private Sub CommandButton1_Click()
'OK Add this record
If TextBox6.Value = "" Then
MsgBox "There is NO Value in Textbox 6 "
TextBox6.SetFocus
Else
AddsRecord 'Sub below
End If
This works so far as to give me the message. But, it blanks out all
the textboxes the user filled out before hitting the OK button as if
it were starting over.
What I want is for all the data already entered in to be left alone,
and the focus set on TextBox6 to enter in a value. The user would do
this, then hit the OK button again, and all the data will be copied to
the sheet. I’m sure I’m almost there. Can anyone help??
Thanks
j.o.