[AccessD] values separated by .

Gustav Brock Gustav at cactus.dk
Fri Feb 18 12:37:19 CST 2005


Hi Pedro

It needs two params: the string, and the element (0 to 7) to extract:

  ExtractN("6.11.3.1.2(0m).1.0.1", 4)

/gustav

>>> pedro at plex.nl 18-02-2005 19:20:30 >>>
Hello Gustav,

thanks for the help (also thanks Borge and Jim).
When i call the punction in the On Click event i get an error: The
expression you entered has a function containing the wrong number of
arguments.

What is going wrong.
I don'r see it (but this also could be the result of my headache while
having the flu)

Pedro



----- Original Message -----
From: "Gustav Brock" <Gustav at cactus.dk>
To: <accessd at databaseadvisors.com>
Sent: Friday, February 18, 2005 3:23 PM
Subject: Re: [AccessD] values separated by .


> Hi Pedro
>
> As Jim mentions, I think Split will do.
> It creates an array but have in mind you can address the elements of
> this directly with this syntax:
>
>   strElementn = Split("6.11.3.1.2(0m).1.0.1", ".")(n)
>
> Thus, for field E use
>
>   strElementE = Split("6.11.3.1.2(0m).1.0.1", ".")(4)
>
> which returns
>
>   2(0m)
>
> However, SQL doesn't seem to be happy with this syntax, so you may
have
> to run VBA to update this or create a small wrapper function which
does
> the extract:
>
> Public Function ExtractN(ByVal strList As String, ByVal lngElement
As
> Long) As String
>
>   On Error Resume Next
>   ExtractN = Split(strList, ".")(lngElement)
>
> End Function
>
> /gustav
>
>
> >>> pedro at plex.nl 18-02-2005 14:00:02 >>>
> Hello group,
>
> I have a field [formula] with values that look like:
> 6.11.3.1.2(0m).1.0.1
> Each value is separated by a dot  (.)
> As you can see, not al values are numbers.
>
> I would like each value in a separated field. FieldA to FieldH.
>
> I could do this with Left, Right or Middle function, but it takes
time
> an 8 functions
>
> Is there a better way to do this in one.




More information about the AccessD mailing list