G
Guest
I have a text box which receives a 10 digit number.
A fucntion is then called and the validity of the number is checked.
If the number is invalid the bacground colour of the text box is changed to
RED and the focus and Selection for the text box is re-set
Sub ChangeTextBoxColour()
'change text box colour to show alert
frmHotlist.txtCardNumber.BackColor = RGB(255, 0, 0)
frmHotlist.txtCardNumber.SetFocus
frmHotlist.txtCardNumber.SelStart = 0
frmHotlist.txtCardNumber.SelLength = 10
End Sub
This initially worked fine until I inserted another text box for the
insertion of a date the validity of the text is checked using IsDate()
This then calls a subroutine to change the text box colour and reset the
focus on the text box (all incidentally to speed up entering data into the
form)
HOWEVER.
The second setfocus refused to work! as did the selection process.
when I went back to my first text box and rem out the code of the setfocus
to see if the second set focus would work then nothing happened THEN AFTER
putting the code back to the way it was the FIRST TEXT BOX will not work
either!
Is anyone aware it there is some kind of bug in the software or should I be
doing something else?
A fucntion is then called and the validity of the number is checked.
If the number is invalid the bacground colour of the text box is changed to
RED and the focus and Selection for the text box is re-set
Sub ChangeTextBoxColour()
'change text box colour to show alert
frmHotlist.txtCardNumber.BackColor = RGB(255, 0, 0)
frmHotlist.txtCardNumber.SetFocus
frmHotlist.txtCardNumber.SelStart = 0
frmHotlist.txtCardNumber.SelLength = 10
End Sub
This initially worked fine until I inserted another text box for the
insertion of a date the validity of the text is checked using IsDate()
This then calls a subroutine to change the text box colour and reset the
focus on the text box (all incidentally to speed up entering data into the
form)
HOWEVER.
The second setfocus refused to work! as did the selection process.
when I went back to my first text box and rem out the code of the setfocus
to see if the second set focus would work then nothing happened THEN AFTER
putting the code back to the way it was the FIRST TEXT BOX will not work
either!
Is anyone aware it there is some kind of bug in the software or should I be
doing something else?