473,379 Members | 1,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

extracting partial field value

using access 2000 database. I have a need to extract a partial value in a field. for example I have a table with full names, for example "John Smith", "Jamie Johnson", and I need to be able to extract just the last name. Basically everything right of the last space.

Help?
Jul 17 '07 #1
3 2093
missinglinq
3,532 Expert 2GB
You have to understand that this will only work if the names are always entered in the format you gave, i.e. "Jamie Johnson."

Expand|Select|Wrap|Line Numbers
  1.  LastName = right(FullName,(len(FullName)-instr(FullName," ")))
Good Luck and Welcome to TheScripts!

Linq ;0)>
Jul 18 '07 #2
Thanks, worked great. but like you said, it only works if there is only one space in the field. If the field has a entry like "Jamie V Johnson", "V Johnson" shows. Is there a way to pull just "Johnson"?
Jul 18 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Try this ...

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim pos As Integer
  3. Dim newpos As Integer
  4. Dim lastname As String
  5. Dim rpt As Boolean
  6.  
  7.     pos = 1
  8.     rpt = True
  9.  
  10.     Do Until rpt = False
  11.         newpos = InStr(pos + 1, FullName, " ")
  12.         If newpos <> 0 Then
  13.             pos = newpos
  14.         Else
  15.             rpt = False
  16.         End If
  17.     Loop
  18.  
  19.     lastname = Right(FullName, Len(FullName) - pos)
  20.  
Jul 18 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: lecichy | last post by:
Hello Heres the situation: I got a file with lines like: name:second_name:somenumber:otherinfo etc with different values between colons ( just like passwd file) What I want is to extract...
1
by: v0lcan0 | last post by:
Any help on extracting the time part from the datetime field in SQL database. even though i had entered only the time part in the database when i extract the field it gives me only the date...
27
by: gRizwan | last post by:
Hello all, We have a problem on a webpage. That page is sent some email data in base64 format. what we need to do is, decode the base64 data back to original shape and extract attached image...
2
by: Johnny Gardner | last post by:
I'm hoping this is simple: field1 | field2 abc-123 def-456 abc-123 I need to update field2 to everything that comes after the dash in field 1. So final result would be
2
by: Dickyb | last post by:
Extracting an Icon and Placing It On The Desktop (C# Language) I constructed a suite of programs in C++ several years ago that handle my financial portfolio, and now I have converted them to...
9
by: Fat Elvis | last post by:
I'd like to extend some of my Asp.net pages by using Partial Classes. Example ASP.Net Page: public partial class Admin_Customer : System.Web.UI.Page { protected void Page_Load(object sender,...
4
by: srikanthr | last post by:
how do i get the constraints associated with a table. is there any system table which stores the constraint details. Atleast how do I know if a column is nullable or not
4
by: Debbiedo | last post by:
My software program outputs an XML Driving Directions file that I need to input into an Access table (although if need be I can import a dbf or xls) so that I can relate one of the fields...
9
by: Hamayun Khan | last post by:
Hi I m using form like below <form action='' method = post> <input type=text name=txt id=txt> <select name=region id=region multiple> <option value=1>ONE</option> <option value=2>Two</option>...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.