Click to See Complete Forum and Search --> : VbScript Form Validations


January 19th, 2000, 07:38 AM
Hi,
In Form Validations i have used the following code:-

If IsNumeric(txtJobCode.Text) Then
If txtJobCode.Text < 100 Or txtJobCode.Text > 174 Then
MsgBox "Please enter a number for JOBCODE between 100 and 174 only."
End If
txtJobCode.SetFocus
End If

So my problem is that my textbox which is txtJobCode does not get the setfocus again and so i get a vbScript error. I do get the my form validation MsgBox "Please enter a number for JOBCODE between 100 and 174 only." no doubt....... but the text box never gets the focus again.
How do i do this????????
Thanks in advance,
New to VB......;)

Lothar Haensler
January 19th, 2000, 08:31 AM
I'm confused.
Your subject says "VBScript..." and you use VB syntax in the code sample.
If your code runs inside an HTML page, you need to use the methods of the DOM (document object model). In order to set the focus to a control, call controlname.focus(). SetFocus is for VB only.

bharat
January 19th, 2000, 11:19 PM
You are using VBScripting and not Visual Basic 6.0 You have to use the Data Object Model for VBScripting for that what u have to do is u've to use
control.Focus() for ur purpose. I think this will do the needful for u
Happy VBScripting

bharat