Can't Assign to Array

  • Thread starter Thread starter XMan
  • Start date Start date
X

XMan

I've got this message of "Can't assign to array" with this code:

Private Sub Form_Load()
Dim arTest() As String

arTest = Split(Me.OpenArgs, ",")
End Sub

Am I missing something here? TIA.
 
XMan said:
I've got this message of "Can't assign to array" with this code:

Private Sub Form_Load()
Dim arTest() As String

arTest = Split(Me.OpenArgs, ",")
End Sub

Am I missing something here? TIA.


Works for me, provided that OpenArgs isn't Null. What version of Access
are you using? Split() was introduced with Access 2000, so if you're
using Access 97 you have to write your own version. Do you have Option
Explicit set for the module?
 
I'm using Access97 and got the code for Split() function.

What I've found to work is to declare the array as Variant like this

Dim arTest As Variant

and it works.

Thanks for your help.
 
XMan said:
I'm using Access97 and got the code for Split() function.

What I've found to work is to declare the array as Variant like this

Dim arTest As Variant

and it works.

Thanks for your help.

Probably the function code you got returns a Variant, not an array,
unlike the VB6 Split() function. Anyway, since you've got it working,
all is well.
 
Back
Top