hello all
i am trying to return an array from a function
however it is not working
i am not sure why
here are the functions, the functions that returns the array and he call function
any comments?any ideas?
thank you
Lina
Option Compare Database
Function CreateResArray() As Variant
Dim db As Database
Set db = CurrentDb
Dim mesReseaux() As String
Dim j As Integer
j = 0
Dim RS As DAO.Recordset
Set RS = db.OpenRecordset("T106 Importation Reseau", dbOpenDynaset)
Do Until RS.EOF
mesReseaux(j) = RS!Réseau
j = j + 1
RS.MoveNext
Loop
CreateResArray = mesReseaux
End Function
the call function
Function GetRes(i) As String
Dim db As Database
Set db = CurrentDb
Dim reseauxArray As Variant
reseauxArray = CreateResArray()
GetRes = reseauxArray(i)
End Function
i am trying to return an array from a function
however it is not working
i am not sure why
here are the functions, the functions that returns the array and he call function
any comments?any ideas?
thank you
Lina
Option Compare Database
Function CreateResArray() As Variant
Dim db As Database
Set db = CurrentDb
Dim mesReseaux() As String
Dim j As Integer
j = 0
Dim RS As DAO.Recordset
Set RS = db.OpenRecordset("T106 Importation Reseau", dbOpenDynaset)
Do Until RS.EOF
mesReseaux(j) = RS!Réseau
j = j + 1
RS.MoveNext
Loop
CreateResArray = mesReseaux
End Function
the call function
Function GetRes(i) As String
Dim db As Database
Set db = CurrentDb
Dim reseauxArray As Variant
reseauxArray = CreateResArray()
GetRes = reseauxArray(i)
End Function