Anita
Nov 30th, 1999, 03:41 AM
I have written the following code and it is giving a compile error" For without Next"
For ncontrolno = 0 To Employer.Controls.Count - 1
If TypeOf Employer.Controls(ncontrolno) Is TextBox Then
If Employer.Controls(ncontrolno(Index)) = 0 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a Company Name"
Exit Sub
End If
Else
If Employer.Controls(ncontrolno(Index)) = 1 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a Vocation"
Exit Sub
End If
Else
If Employer.Controls(ncontrolno(Index)) = 2 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a Name"
Exit Sub
End If
Else
If Employer.Controls(ncontrolno(Index)) = 3 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a Address"
End If
Else
If Employer.Controls(ncontrolno(Index)) = 4 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a City"
End If
Exit Sub
End If
End If
Next
Please help me!!
For ncontrolno = 0 To Employer.Controls.Count - 1
If TypeOf Employer.Controls(ncontrolno) Is TextBox Then
If Employer.Controls(ncontrolno(Index)) = 0 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a Company Name"
Exit Sub
End If
Else
If Employer.Controls(ncontrolno(Index)) = 1 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a Vocation"
Exit Sub
End If
Else
If Employer.Controls(ncontrolno(Index)) = 2 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a Name"
Exit Sub
End If
Else
If Employer.Controls(ncontrolno(Index)) = 3 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a Address"
End If
Else
If Employer.Controls(ncontrolno(Index)) = 4 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a City"
End If
Exit Sub
End If
End If
Next
Please help me!!