Hi I have an array, created by a recordset, and I want to pass it to a
function along with the value. the function will check if the value is in
the array and return YES / NO
I'm getting a comile error of TypeMismatch: Array
I have a feeling the array that is created by the Getrecords is my problem
as I don't now what type it is.
Private Sub main()
Dim rs As New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "select ID from tAccounts", CurrentProject.Connection,
adOpenDynamic, adLockOptimistic
iPos = rs.RecordCount
rs.MoveFirst
aIFIS = rs.GetRows(iPos)
rs.Close
testval = "123456"
retval = ValidAccount aIFIS, testval
msgbox retval
End Sub
Private Function ValidAccount(aIFISx() As String, sValx As String)
Dim sValx As String, i As Integer
MsgBox aIFISx(i)
For i = LBound(aIFISx) To UBound(aIFISx)
If sValx = aIFISx(i) Then
sValx = "VALID"
Exit For
Else
sValx= "NOTVALID"
End If
Next i
End Function
Alex Dybenko - 22 Feb 2005 15:18 GMT
Try to declare aIFIS as variant, and pass it as variant to ValidAccount
instead of string
BTW, correct syntax is:
retval = ValidAccount (aIFIS, testval)

Signature
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com
> Hi I have an array, created by a recordset, and I want to pass it to a
> function along with the value. the function will check if the value is in
[quoted text clipped - 31 lines]
> Next i
> End Function
Andi Mayer.. - 22 Feb 2005 15:26 GMT
>Hi I have an array, created by a recordset, and I want to pass it to a
>function along with the value. the function will check if the value is in
[quoted text clipped - 31 lines]
> Next i
>End Function
this array has the be a variant

Signature
If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW