G
Guest
I am fairly new to this level of programming but I've managed to write the
following code where I'm attempting to use and array in a For Loop
unfortunately it gives me "Type Mismatch" error on the "For j = x(0) To x(8)"
on line 6.
I don't understand why it would not recognize the number sequence....?
CODE:
Public Function CheckPending(Name)
Dim x
x = Array("BanCk18", "BanCk36", "ChsCk18", "ChsCk36", "LmnCk18", "LmnCk36",
"MrbCk18", "MrbCk36", "PndCk18", "PndCk36")
For j = x(0) To x(8)
If j <> Name Then
PrdIN = j & "In"
Prdout = j & "Out"
If IsNull(Me.Controls(PrdIN).Value) = False Then
If IsNull(Me.Controls(Prdout).Value) = False Then
MsgBox "ATTENTION: There is a pending product that
needs to be completed prior to strating a new one.", vbExclamation, "Pending
Product"
Cancel = True
Me.Controls(PrdIN).Undo
Exit Function
End If
End If
End If
Next j
DoEvents
End Function
following code where I'm attempting to use and array in a For Loop
unfortunately it gives me "Type Mismatch" error on the "For j = x(0) To x(8)"
on line 6.
I don't understand why it would not recognize the number sequence....?
CODE:
Public Function CheckPending(Name)
Dim x
x = Array("BanCk18", "BanCk36", "ChsCk18", "ChsCk36", "LmnCk18", "LmnCk36",
"MrbCk18", "MrbCk36", "PndCk18", "PndCk36")
For j = x(0) To x(8)
If j <> Name Then
PrdIN = j & "In"
Prdout = j & "Out"
If IsNull(Me.Controls(PrdIN).Value) = False Then
If IsNull(Me.Controls(Prdout).Value) = False Then
MsgBox "ATTENTION: There is a pending product that
needs to be completed prior to strating a new one.", vbExclamation, "Pending
Product"
Cancel = True
Me.Controls(PrdIN).Undo
Exit Function
End If
End If
End If
Next j
DoEvents
End Function