[AccessD] Turn a string into an array

Gustav Brock gustav at cactus.dk
Thu Aug 19 07:37:14 CDT 2021


Hi Arthur

Try this demo:

<code>
Public Sub ArrayDemo()

    Const Sample    As String = "123, 456,  789"
    
    Dim Elements()  As String
    Dim Index       As Integer
    
    Elements = Split(Sample, ",")
    
    For Index = LBound(Elements) To UBound(Elements)
        Debug.Print Elements(Index),
        Elements(Index) = Trim(Elements(Index))
        Debug.Print Elements(Index)
    Next
    
End Sub
</code>

-----Oprindelig meddelelse-----
Fra: AccessD <accessd-bounces+gustav=cactus.dk at databaseadvisors.com> På vegne af Arthur Fuller
Sendt: 19. august 2021 14:24
Til: Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Emne: Re: [AccessD] Turn a string into an array

I thinkI typed the example and got a type mismatch error.
? Split( "this is a srring")
Type mismatch
? Splt( "1,2", ",")
Type  mismatch
I think  I am losing it. 


More information about the AccessD mailing list