GaelicFatboy
Registered User.
- Local time
- Today, 23:21
- Joined
- Apr 17, 2007
- Messages
- 100
This is a follow on from a thread posted last week called 'Control focus following "Enter" key press'.
I've got a control called Text_Box1 that I wish to keep the focus on once a number has been entered and the 'Enter' key has been pressed. If I use the follow code the focus stays with the control.
Private Sub Text_Box1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode=13 Then KeyCode=0
End Sub
However, once the 'Enter' key has been pressed I do need to get the number entered into the text box, but it's here that I'm having the diffeculty. Can someone please explain why I'm getting a 'Null' error for the text box contents using the following code and more importantly how can I get round the problem?
Private Sub Text_Box1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim My_Number As Long
If KeyCode=13 Then
KeyCode=0
My_Number=Me.Text_Box1 'this line causes a Null error
Call Get_PartsDetail(My_Number)
End Sub
NB: The text box does contain a long integer number when the 'Enter' Key is pressed.
Cheers for your help
D
I've got a control called Text_Box1 that I wish to keep the focus on once a number has been entered and the 'Enter' key has been pressed. If I use the follow code the focus stays with the control.
Private Sub Text_Box1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode=13 Then KeyCode=0
End Sub
However, once the 'Enter' key has been pressed I do need to get the number entered into the text box, but it's here that I'm having the diffeculty. Can someone please explain why I'm getting a 'Null' error for the text box contents using the following code and more importantly how can I get round the problem?
Private Sub Text_Box1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim My_Number As Long
If KeyCode=13 Then
KeyCode=0
My_Number=Me.Text_Box1 'this line causes a Null error
Call Get_PartsDetail(My_Number)
End Sub
NB: The text box does contain a long integer number when the 'Enter' Key is pressed.
Cheers for your help
D