Home  |  About  |   Search   

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

RunCommand Constants

Terms of Use


 

Strings: Parse one field's data into multiple fields

Author(s)
Dev Ashish

(Q) I have a Name field in my table which contains user names in the format "Doe, John". How can I easily separate them into individual fields, LastName and FirstName?

(A) Using the following logic, you can either run an Update query or assign the values through a DAO operation in code.

FirstName: Right$([Name],Len([Name])- InStr(1,[Name],",")-1)

LastName: Left$([Name],InStr(1,[Name],",")-1)

Note: Using similar logic and through the use of Instr, Mid, Left, Right and other string functions, you can extract any part of a given string.


1998-2009, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer