split field into elements using update query (1 Viewer)

y2k

Registered User.
Local time
Today, 19:15
Joined
Mar 11, 2002
Messages
36
Is it possible to split a field (eg name) into different elements (eg first name, last name etc)? I'm using an update query to update a table from an externamlly linked database (linked table) and need to split a field into individual elements.

Can anybody help?
 

Geoff Codd

Registered User.
Local time
Today, 19:15
Joined
Mar 6, 2002
Messages
190
show me an example of how the data looks, is there a gap between first last name or a comma etc
 

y2k

Registered User.
Local time
Today, 19:15
Joined
Mar 11, 2002
Messages
36
They're seperated by a coma in the format last name,first name. However, I also want to do this to a date which is not seperated by anything so how would I go about that. Would it be the exact same? The date is in MMDDYY and I need to split it into MM, DD & YY in 3 different fields. There are no characters between te month and day and between the day and year. Any ideas at all?

Thanx!!!
 

David R

I know a few things...
Local time
Today, 13:15
Joined
Oct 23, 2001
Messages
2,633
InStr() will find the position of the comma in your name field. Then use Right() and Left() to separate out the actual words from the comma.

Fixed length fields are even easier. Use Left(), Mid(), Right() to break out the pieces in the lengths you need.
 

Geoff Codd

Registered User.
Local time
Today, 19:15
Joined
Mar 6, 2002
Messages
190
for first name use FirstName: Left([name],InStr(1,[name],",")-1)
for last name use LastName: Right(Trim([name]),Len(Trim([name]))-InStr(1,[name],","))

Are you really sure that you want to split the date into 3 fields would it not me better to convert it to mm/dd/yy
 

y2k

Registered User.
Local time
Today, 19:15
Joined
Mar 11, 2002
Messages
36
Left(), Mid() & Right() sounds like exactly what I need. can you help me out on it.. what's the syntax????

Yes, I need to split these fields as they're used later on.

Thanx!!
 

Geoff Codd

Registered User.
Local time
Today, 19:15
Joined
Mar 6, 2002
Messages
190
month = month: Left([date],2)
day = day: Mid([date],3,2)
year = year: Right([date],2)
 

Users who are viewing this thread

Top Bottom