Solved

Need help separating data in a string

Posted on 2013-06-26
5
201 Views
Last Modified: 2013-06-28
I have thousands of records in a single field within a table in the following format

\\SERVERNAME\C$\DOCUMENTS AND SETTINGS\USERNAME

The actual data has different values for SERVERNAME AND USERNAME then shown above. I would like to extract the SERVERNAME  and USERNAME values into their own fields.

How to do?
0
Comment
Question by:snyperj
  • 2
  • 2
5 Comments
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
Dim arr
dim Myservername as string
dim MyUsername as string
arr= split(mid(yourfieldnamehere,3), "/")

MyServername = arr(0)
MyUsername = arr(3)
0
 

Author Comment

by:snyperj
Comment Utility
Sorry should have been more specific on what I was looking for.  I created a 'server' and a 'username' field in the table... so I was just looking for how to populate this with an update query run against the table.
0
 
LVL 77

Accepted Solution

by:
peter57r earned 250 total points
Comment Utility
Depends on which version of Access you have.

For the latest couple of versions ...

Update tablename set [server] =  split(mid(yourfieldnamehere,3), "/")(0),
[username] =split(mid(yourfieldnamehere,3), "/")(3)
0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 total points
Comment Utility
try this update query, change tablex and [fieldName] accordingly

update tablex
set server=Mid([fieldName], 3, InStr(3, [fieldName], "\") - 3)
, username=Mid([fieldName], InStrRev([fieldName], "\") + 1)
0
 

Author Closing Comment

by:snyperj
Comment Utility
didn't need to do it afterall, but thanks.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now