I get a "Type Mismatch" when I try to access the Nv array (see end of code.) Could someone help?


<vb code>
Option Explicit
Dim X As Double, Y As Double, Z As Double

'Function Arguements dimensioned in Type.
Type CrossValues
VecI As Double
VecJ As Double
VecK As Double
End Type

'Arrays used in Project.
Dim n(500, 3) As Double
Public Bp(1, 42, 3) As Double, Nv(1, 42, 3) As CrossValues
____________________________________________________
Public Function Cal_Norm_Vecs(VecI As Double, VecJ As Double, VecK As Double) As CrossValues
Dim Pred As Integer, Succ As Integer, Results As CrossValues


Succ = I + 1
If I <> ((Numpts / 2) + 1) Then
Pred = I - 1
Else
Pred = 0
End If
If I = (Numpts / 2) Then
GoTo Bypass
End If
If I <> 0 Then
n(101, 1) = Bp(Rad1, Pred, 1) - Bp(Rad1, I, 1)
n(101, 2) = Bp(Rad1, Pred, 2) - Bp(Rad1, I, 2)
n(101, 3) = Bp(Rad1, Pred, 3) - Bp(Rad1, I, 3)
n(102, 1) = Bp(Rad2, I, 1) - Bp(Rad1, I, 1)
n(102, 2) = Bp(Rad2, I, 2) - Bp(Rad1, I, 2)
n(102, 3) = Bp(Rad2, I, 3) - Bp(Rad1, I, 3)
n(103, 1) = Bp(Rad1, Succ, 1) - Bp(Rad1, I, 1)
n(103, 2) = Bp(Rad1, Succ, 2) - Bp(Rad1, I, 2)
n(103, 3) = Bp(Rad1, Succ, 3) - Bp(Rad1, I, 3)
'Call Sub Unit below.
Dim Vecs As Integer
For Vecs = 101 To 103
Call Unit(Val(Vecs), Val(Vecs))
Next Vecs
'Call Sub Cross below.
'If Profile Points are North of Blade [Y Axis Orientated East/West.]
If I > 20 Then
Call Cross(102, 101, 104)
Call Cross(103, 102, 105)
Else
'Profile Points are South of Blade [Y Axis Orientated East/West.]
Call Cross(101, 102, 104)
Call Cross(102, 103, 105)
End If
'Dimension Statements for Math Variables.
Dim X1 As Double, Y1 As Double, Z1 As Double, _
X2 As Double, Y2 As Double, Z2 As Double
'Assigning Variables [104 & 105 are products of Sub Cross.]
X1 = n(104, 1)
Y1 = n(104, 2)
Z1 = n(104, 3)
X2 = n(105, 1)
Y2 = n(105, 2)
Z2 = n(105, 3)
'Square Root of the Radial Unit Vector.
X = Sqr(X1 ^ 2 + Y1 ^ 2 + Z1 ^ 2)
'Square Root of the Radial Unit Vector.
Y = Sqr(X2 ^ 2 + Y2 ^ 2 + Z2 ^ 2)
X1 = X1 / X
Y1 = Y1 / X
Z1 = Z1 / X
X2 = X2 / Y
Y2 = Y2 / Y
Z2 = Z2 / Y
'Averaging Vectors.
X = (X1 + X2) / 2
Y = (Y1 + Y2) / 2
Z = (Z1 + Z2) / 2
End If 'Ends If I <> 0.
If I = 0 Then
X = Bp(1, 0, 1) - Bp(0, 0, 1)
Y = Bp(1, 0, 2) - Bp(0, 0, 2)
Z = Bp(1, 0, 3) - Bp(0, 0, 3)
End If
Dim Nor As Double
'Square Root of the Radial Unit Vector.
Nor = Sqr(X ^ 2 + Y ^ 2 + Z ^ 2)
X = X / Nor
Y = Y / Nor
Z = Z / Nor
VecI = X
VecJ = Y
VecK = Z
Dim Temp As Double
'If Point is 0-Insp. then
'Vector J becomes I and vise-versa.
If I = 0 Then
Temp = VecK
VecK = VecI
VecI = -Temp
End If
'If Points are on the Web and do not equal zero then.
If Rad1 = 0 And I <> 0 Then
VecI = -VecI
Results.VecI = VecI
VecJ = -VecJ
Results.VecJ = VecJ
VecK = -VecK
Results.VecK = VecK
End If
Cal_Norm_Vecs = Results

Bypass:

End Function
____________________________________________________

Sub cmdCompute_Click()
'Read Blueprint Array.
Call StatorArray
Numpts = 42 'Stator Blade Profile Points
Rad1 = 0 '53.5 Radius
Rad2 = 1 '71.6 Radius

RunComputations:
'Initializing I
I = 0
Dim Look as Double
For I = 0 To Numpts - 1
Nv(Rad1, I, 1) = Cal_Norm_Vecs(1, 0, 0)
Look =Nv(Rad1, I, 1)
Nv(Rad1, I, 2) = Cal_Norm_Vecs(0, 2, 0)
Nv(Rad1, I, 3) = Cal_Norm_Vecs(0, 0, 3)
Next I
If Rad1 = 0 Then
Rad1 = 1
Rad2 = 0
GoTo RunComputations
End If
End Sub

<vb code>