1

Topic: Array. I can not transfer from variable function

Dim x () As Variant
ReDim x (LBound (y_func ("ololol"), 1) To UBound (y_func ("ololol"), 1), _ ' it was not primary this line, wrote in attempt'
LBound (y_func ("ololol"), 2) To UBound (y_func ("ololol"), 2)) ' to correct, but it all the same does not work'
x = y_func ("ololol") ' Writes type mismatch'
End Sub
Function SplitPrmCln (NamePrmtr As String) As Variant
Dim y As String, x As Variant, i As Integer, j As Integer, cnt As Integer
y = CurrentDb. OpenRecordset ("Select VLE from prmtr_main where Prmtr = '" BOTH NamePrmtr AND "'")! Vle ' y=1_4_3,2_4_6,3_5_-3,4_5_0'
x = Split (y ",")
ReDim x (LBound (x) To UBound (x), 1 To 3)
For i = LBound (x, 1) To UBound (x, 1)
For j = 0 To 2
x (i, j + 1) = Split (Split (y ",") (i), "_") (j)
Next
Next
SplitPrmCln = x
End Function

Help, please! How to transfer value of this function?
____
vk.com/taenfox

2

Re: Array. I can not transfer from variable function

Explain you to me, what for you  y in an array x , and then at once all  you merge in a basket redefinition?

3

Re: Array. I can not transfer from variable function

Akina wrote:

Explain you to me, what for you  y in an array x , and then at once all  you merge in a basket redefinition?

It is my one-and-a-half experience with an array. When did function it why that swore on dimensionality of an array or I not correctly understood...
If show as it was correctly necessary to make it I will be immensely grateful! (where it is more...)
But here it is direct   - I can not transfer this array from function

4

Re: Array. I can not transfer from variable function

And if so?
Function SplitPrmCln (NamePrmtr As String) As Variant ()

5

Re: Array. I can not transfer from variable function

4d_monster wrote:

And if so?
Function SplitPrmCln (NamePrmtr As String) As Variant ()

Well, it led to a similar error in line

SplitPrmCln = x

6

Re: Array. I can not transfer from variable function

MokeevP wrote:

Dim x>>> () <<<As Variant

brackets here remove, and all to "be adjusted"
Everyones ReDim -
To address to elements as x (i) (j)

7

Re: Array. I can not transfer from variable function

court wrote:

it is passed...
Brackets here remove, and all to "be adjusted"
Everyones ReDim -
To address to elements as x (i) (j)

Works! Thanks!
Truth with redim' did not understand as correctly it is necessary to arrive

8

Re: Array. I can not transfer from variable function

MokeevP;
It, ReDim all the same it was necessary...
Somehow so

Sub test ()
Dim s As String, arr As Variant, arr1 As Variant, i As Long, j As Long
s = "1_4_3,2_4_6,3_5_-3,4_5_0"
arr = Split (s ",")
arr1 = Array ()
ReDim arr1 (UBound (arr))
For i = LBound (arr) To UBound (arr)
arr1 (i) = Split (arr (i), "_")
Next
'------------------------------------------------------
Debug. Print "i", "j", "value"
Debug. Print "---------------------------------"
For i = LBound (arr1) To UBound (arr1)
For j = LBound (arr1 (i)) To UBound (arr1 (i))
Debug. Print i, j, arr1 (i) (j)
Next
Next
End Sub
i j value
---------------------------------
0 0 1
0 1 4
0 2 3
1 0 2
1 1 4
1 2 6
2 0 3
2 1 5
2 2-3
3 0 4
3 1 5
3 2 0