Z
Zane Greer
I have created a program in Excel 2000, which is used on a Windows 98,
Windows 2000 and Windows XP (Home Addition) platform. My problem is
the same on all platforms. The program contains 10 UserForms that
contain numerous Textboxes, comboboxes, listboxes, etc. Information is
entered into the textboxes and eventually transferred to forms for
printing, and a spreadsheet is used to maintain historical records.
Information fed into some of the textboxes is validated prior to the
user being able to continue to the next stage. When the user clicks
CommandButton1 the UserForm is hidden and the data entered validated.
If the data entered is invalid a MsgBox appears with a message
advising the user, who must then click the OK button to continue.
Upon clicking the OK button the unacceptable data that has been
entered in the textbox is erased and the UserForm re-appears so that
the user can enter the correct data. My problem is that I cannot get
the SETFOCUS command to activate the textbox when the UserForm
re-appears.
For example the Userform10 Code contains:
Private Sub commandbutton2_Click()
UserForm10.Hide
UserForm10.TextBox1.SetFocus
UserForm1.Show
End Sub
The UserForm1 Code contains:
Private Sub Commandbutton4_Click()
UserForm1.Hide
UserForm10.Show
UserForm10.TextBox1.SetFocus
End Sub
Windows 2000 and Windows XP (Home Addition) platform. My problem is
the same on all platforms. The program contains 10 UserForms that
contain numerous Textboxes, comboboxes, listboxes, etc. Information is
entered into the textboxes and eventually transferred to forms for
printing, and a spreadsheet is used to maintain historical records.
Information fed into some of the textboxes is validated prior to the
user being able to continue to the next stage. When the user clicks
CommandButton1 the UserForm is hidden and the data entered validated.
If the data entered is invalid a MsgBox appears with a message
advising the user, who must then click the OK button to continue.
Upon clicking the OK button the unacceptable data that has been
entered in the textbox is erased and the UserForm re-appears so that
the user can enter the correct data. My problem is that I cannot get
the SETFOCUS command to activate the textbox when the UserForm
re-appears.
For example the Userform10 Code contains:
Private Sub commandbutton2_Click()
UserForm10.Hide
UserForm10.TextBox1.SetFocus
UserForm1.Show
End Sub
The UserForm1 Code contains:
Private Sub Commandbutton4_Click()
UserForm1.Hide
UserForm10.Show
UserForm10.TextBox1.SetFocus
End Sub