[AccessD] Splitting information from One field into Two and dumping the middle

Stuart McLachlan stuart at lexacorp.com.pg
Sat Dec 11 19:54:13 CST 2004


On 11 Dec 2004 at 17:17, Technical Designs wrote:
 
> I have one field [FullName] with .           Name:number
> or
> Name:subname:number              where there can be more than one recurrence
> of subnames
> 
> What I would like to do is split "name" into [splitname] and "number" into
> [splitnumber] fields of tblTable and loose the middle subnames (if there are
> any)
>

What version of Access. If it's 2K or above you can use the built in 
Split() Function

<quote>
Split Function
Description
Returns a zero-based, one-dimensional array containing a specified number 
of substrings.

Syntax
Split(expression[, delimiter[, limit[, compare]]])
</quote>

Try This:

Dim strParts() as String
......
strParts = Split(Fullname,":")
'Get First element 
Me.Splitname = strParts(0)
'Get last element
Me.SplitNumber = strParts(UBound(strParts)



-- 
Stuart





More information about the AccessD mailing list