splitting strings with delimiter (1 Viewer)

eatraas

Registered User.
Local time
Today, 07:10
Joined
Jan 23, 2009
Messages
96
Hi,

I'm confused about how to split a string.
The field contains data like "uususjsj;ueueuej;ooooek", in this case, I want to split it into 3 separate strings and want to add this in a table

Code i have so far is
PHP:
aantalpc = UBound(Split(rcs!jobreb, ";"))
  For i = 1 To aantalpc + 1
   poseen = InStr(rcs!jobreb, ";")
   jobreb = rcs!jobreb
   rcs.AddNew
    If i = 1 Then
     rcs!jobreb = Left(jobreb, poseen - 1)
    Else
     rcs!jobreb = Mid(jobreb, poseen, Len(jobreb) - poseen)
    End If
   
   rcs.Update
  
  Next
    
 End If

The first is going good, the second and third not.

IS there an easier way to do it?

Regards and thanks in advance.

Erwin
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:10
Joined
May 7, 2009
Messages
19,233
use the Split() function:
Code:
dim var as variant
dim arrVar as variant

arrVar= split(rcs!jobreb, ";")
for each var in arrVar
   rcs.AddNew
   rcs!jobreb = var
   rcs.Update
next var
 

eatraas

Registered User.
Local time
Today, 07:10
Joined
Jan 23, 2009
Messages
96
Thank you , solved, i was almost there but you were faster.
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 10:10
Joined
Apr 27, 2015
Messages
6,322
Hello there,

In addition to your code. If you were looking for something a little more dynamic that could be used in the query builder, here is a very nifty utility that I use:
 

June7

AWF VIP
Local time
Today, 06:10
Joined
Mar 9, 2014
Messages
5,466
You are splitting string and saving multiple records back to same table as source record? That doesn't quite make sense - unless this is just a list of words.
 
Last edited:

Users who are viewing this thread

Top Bottom