Hi,
I'm banging my head against the desk because I can't find a solution for the following simple problem. Case: There is a column in a table that has FamilyName and FirstName(s) in one field. ie "McCarthy,J ohn Doe Willy". I have to split up Familyname and the 1st FirstName. The FamilyName works perfect, just looking up the comma with InStr and use Left().
Now can someone throw me a bone to help me get the 1st Firstname. "John" according to the example.
This is what I got but I think InStr function doesn't work properly. I thought the 3 parameters were InStr(placetost artlooking, [field],'SearchString' ) - SELECT
-
Naam_en_voornamen,
-
Left([naam_en_voornamen],InStr(1,[naam_en_voornamen],',')-1) AS Naam,
-
InStr([naam_en_voornamen],',')+1 AS Start,
-
InStr(9,[naam_en_voornamen],'a') AS stop,
-
Mid([naam_en_voornamen],[start],[stop]) AS Voornaam
-
FROM tbl_kankerpreventie;
-
4 3912 MMcCarthy 14,534
Recognized Expert Moderator MVP
Try this: -
-
SELECT Naam_en_voornamen,
-
Left([naam_en_voornamen],InStr(1,[naam_en_voornamen],',')-1) AS Naam,
-
Right([naam_en_voornamen],(Len([naam_en_voornamen])-InStr(1,[naam_en_voornamen],',')+1)) AS Voornaam
-
FROM tbl_kankerpreventie;
-
-
Thanks for the response but that's the same result I get.
This is what I want to achieve: -
"Naam_en_voornamen" | "Naam" | "Voornaam"
-
----------------------------------------------------
-
McCarthy,John Doe Willy | McCarthy | John
-
So it has to drop the "Doe Willy". Locating the first "space" between John Doe is not the problem it's getting out the John ;-)
PEB 1,418
Recognized Expert Top Contributor
Hi,
try; -
SELECT
-
Naam_en_voornamen,
-
Left([naam_en_voornamen],InStr(1,[naam_en_voornamen],',')-1) AS Naam,
-
Mid([naam_en_voornamen],InStr([naam_en_voornamen],',')+1,InStr(1,[naam_en_voornamen]," ")-InStr([naam_en_voornamen],',')-1) AS Voornaam
-
FROM tbl_kankerpreventie;
-
-
:)
Works like a charm, I owe you :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Don Miller |
last post by:
I can't seem to find at MS how to detect the 2002 OS vs. 2003 OS for web
applications using ASP. This is the only page I could find
(http://msdn.microsoft.com/library/en-us/guide_ppc/htm/designing_web_sites_f
or_internet_explorer_for_pocket_pc_cheo.asp) and it only tells how to detect
2000 vs. 2002 (and much of the graphic is cutoff on the right).
It has the code below but it doesn't tell me how to distinguish between 2002
and 2003...
|
by: Paul |
last post by:
Hi all, at present I I've built a website which can be updated by admin and
users.
My problem, I've combined "log in" and "access levels" to restrict access to
certain pages, using the built in "log in" and "user authentication,
restrict access to page" features. But I find the after login I constantly
get redirected from the restricted pages.
|
by: Daniel |
last post by:
I use an Access database to basically take data exports, import them,
manipulate the data, and then turn them into exportable reports. I do
this using numerous macros, and queries to get the data in the format
that I need it in order to create the reports that we use. So far this
has proven to be successful for the reports that I am doing and the
data that I am pulling into it. I just have one challenge that may
require a lot of work and I...
|
by: Wayne Aprato |
last post by:
I have a client who is running several Access 97 databases that I have
written for them. They are about to upgrade to Access 2003. Is the
default file format of Access 2003 still Access 2000 the same as it
was in Access 2002?
I am running Access 2002 at the moment. Is there any reason for
testing purposes etc, for me to purchase Access 2003 if I am going to
recompile the Access 97 mdb files into Access 2000 format mde files
which...
|
by: Peter Frost |
last post by:
Please help
I don't know if this is possible but what I would really like to do is
to use On Error Goto to capture the code that is being executed when
an error occurs.
Any help would be much appreciated.
Thanks in advance
| |
by: dog |
last post by:
I've seen plenty of articles on this topic but none of them have been
able to solve my problem.
I am working with an Access 97 database on an NT4.0 machine, which has
many Access reports.
I want my users to be able to select a report, click on a command
button on a form, which will then automatically create the report as a
pdf file and save it to the user's machine.
I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
|
by: Grasshopper |
last post by:
Hi,
I am automating Access reports to PDF using PDF Writer 6.0. I've
created a DTS package to run the reports and schedule a job to run this
DTS package. If I PC Anywhere into the server on where the job is
running, the job runs sucessfully, PDF files got generated, everything
is good. If I scheduled the job to run at the time that I am not
logged into the server, Access is not able to print to the printer.
The error is pretty...
|
by: Sebastian |
last post by:
Hello
I develop my applications in Access 2002. My development system is
running Windows XP SP2 and I have Microsoft Office XP Developer.
Microsoft Office XP is at SP3.
I used Inno Setup (great product) to install my applications.
When the Access Runtime was needed on the system I simply ran
'accessrt.msi' from Microsoft Office Developer discs.
When another version of Access (other than Access 2002) was on the
system then I simply...
|
by: NeoPa |
last post by:
Access QueryDefs Mis-save Subquery SQL
Access stores its SQL for Subqueries in a strange manner :s It seems to replace the parentheses "()"with square brackets "" and (often) add an extraneous "." after it.
For instance, a simple example illustrates how it works :
SELECT subA.*
FROM (SELECT ,
FROM ) AS subA
becomes (after saving as a querydef in Access) :
SELECT subA.*
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |