Ok... first of all, what version of VB are you running? It's not any of the dotNet versions, is it? The code you posted was for VB6 (actually VB3-VB6), so it'll be a "whole lotta red" in dotNet.
Hopefully, it's VB6, but anyway....
Your comments say you have controls called:
txtName0, txtName1, txtName2
But, you're attempting to loop thru them, as if they were part of an array. They're not.
To convert them to an array is easy, though... and will allow you to loop thru them at will.
Open the form's designer and select each of those controls (one at a time)
Change the name of txtName0 to txtName and set it's Index property = 0. This creates the first element of the control array.
Now, change the name of txtName1 to txtName (same as the first). The Index property should automatically increment and be = 1
Do the same with txtName2... it's Index should = 2 at this point.
Now, you can loop thru them in a couple of different ways. Stick with what you have for now... later, look up:
For Each/Next (instead of For/Next)... using For Each allows easy manipulation of control arrays that contain "holes".
Also, if there's code in any of the events for those controls, you'll need to move that code to the newly named control array's event handlers.
I see a few "issues" in your code that may surprise you.
For example, this code segment....
CODE
If mblnErrorBlank = False And mblnErrorRepeat = False Then
'If there is any code past your "Unload Me", that form
'will automatically reload itself to prevent a crash
'So, the very next line (Load frmInterface) will cause the current
'form to remain in memory.
Unload Me
Load frmInterface
'This may be the functionality you're looking for, but using
'Show, by itself, will allow the code in that sub to continue.
'In other words, it'll show that form and immediately run the
'next code segment, past the End If
frmInterface.Show
'To get the code to wait until the form above closes, use vbModal
'frmInterface.Show vbModal
End If
This post has been edited by Ken Halter: 7 Aug, 2008 - 09:24 PM