Airfix9
Well-known Member
- Joined
- Sep 23, 2005
- Messages
- 886
Hi all,
I am new to user forms and everything is going swimmingly.... BUT!
I have a form with a text box, a combo box and three command buttons on it.
When the form is initialised, the text box (txtInitial) is enabled and blank, the combo box (cboName) is disabled and blank, button 1 (cmdBackName) is enabled, button 2 (cmdName) is disabled and button 3 (cmdExitName) is enabled.
What happens is that the user enters their surname initial and the combo box is filled with all users whose surname initial that is. The user then selects him/herself from the list. Once done, cmdName is enabled allowing the user to import data to the file.
What I want to do is to reset the form when txtInitial is re-entered. My code for this is as follows:
The problem is that the focus is then set to cmdExitName, instead of txtInitial.
For information, the tab indices for each item are as follows (if that makes any difference):
txtInitial 1
cboName 3
cmdBackName 6
cmdName 4
cmdExitName 5
(The reason that 0 and 2 are missing is that they are labels and - I think - not pertinent to this issue).
Where am I going wrong, please?
I am new to user forms and everything is going swimmingly.... BUT!
I have a form with a text box, a combo box and three command buttons on it.
When the form is initialised, the text box (txtInitial) is enabled and blank, the combo box (cboName) is disabled and blank, button 1 (cmdBackName) is enabled, button 2 (cmdName) is disabled and button 3 (cmdExitName) is enabled.
What happens is that the user enters their surname initial and the combo box is filled with all users whose surname initial that is. The user then selects him/herself from the list. Once done, cmdName is enabled allowing the user to import data to the file.
What I want to do is to reset the form when txtInitial is re-entered. My code for this is as follows:
Code:
Private Sub txtInitial_Enter()
txtInitial.Text = ""
cmdName.Enabled = False
txtInitial.SetFocus
End Sub
The problem is that the focus is then set to cmdExitName, instead of txtInitial.
For information, the tab indices for each item are as follows (if that makes any difference):
txtInitial 1
cboName 3
cmdBackName 6
cmdName 4
cmdExitName 5
(The reason that 0 and 2 are missing is that they are labels and - I think - not pertinent to this issue).
Where am I going wrong, please?