473,395 Members | 1,846 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,395 software developers and data experts.

Splitting a field down to create more than 1 field

3
Hi folks

I have an Access database where the address was originally put in as 1 text field. ( Not by me I hasten to add!) The address lines are separated by commas.

Is there some way I can copy the table, but split the address out into 2 or 3 address line fields instead of 1? I need this to do a simple mail merge to existing letters.

Thanks for any ideas.

Liz
Jan 29 '07 #1
4 2286
ADezii
8,834 Expert 8TB
Hi folks

I have an Access database where the address was originally put in as 1 text field. ( Not by me I hasten to add!) The address lines are separated by commas.

Is there some way I can copy the table, but split the address out into 2 or 3 address line fields instead of 1? I need this to do a simple mail merge to existing letters.

Thanks for any ideas.

Liz
We need to know exactly how the [Address] Field is structured with the comma delimiters: e.g. is it [Address], [City], [State], [Zip]? Once we know the structure, we can point you in the right direction.
Jan 29 '07 #2
LizM
3
We need to know exactly how the [Address] Field is structured with the comma delimiters: e.g. is it [Address], [City], [State], [Zip]? Once we know the structure, we can point you in the right direction.
Hi

The address is just text. I have all the other fields, ([City], [State], [Zip]) but the
address lines are just lumped into one field [Address]. Some would only fall into 1 field naturally, but others would fall into 2 or more and are of the form:

floor number, house name, street number street name

I would like to split [Address] into [Address1] [Address2] [Address3] according to whether there are commas in the text.

So [floor number, house name, street number street name] would become
[floor number] [house name] [street number street name]

If there were no commas, then [Address2] [Address3] wuld be empty strings.

Does this make sense?


Thanks
Jan 29 '07 #3
ADezii
8,834 Expert 8TB
Hi

The address is just text. I have all the other fields, ([City], [State], [Zip]) but the
address lines are just lumped into one field [Address]. Some would only fall into 1 field naturally, but others would fall into 2 or more and are of the form:

floor number, house name, street number street name

I would like to split [Address] into [Address1] [Address2] [Address3] according to whether there are commas in the text.

So [floor number, house name, street number street name] would become
[floor number] [house name] [street number street name]

If there were no commas, then [Address2] [Address3] wuld be empty strings.

Does this make sense?


Thanks
I have carefully thought over your problem and decided that everything can be handled with a single Function Procedure. Before I invest time in writing the code, I must be absolutely sure of the details. Please let me know if my assumptions below are correct:

No comma in [Address] Field e.g. (string1)
__[Address1] = [Address]
__[Address2] = <empty string>
__[Address3] = <empty string>

1 comma in [Address] Field e.g. (string1, string2)
__[Address1] = string1
__[Address2] = string2
__[Address3] = <empty string>

2 commas in [Address] Field e.g. (string1, string2, string3)
__[Address1] = string1
__[Address2] = string2
__[Address3] = string3

Is the above interpretation correct? If it is let me know and if not make the necessary corrections. I will also need the name of the Table containing the [Address*] Fields,
Jan 29 '07 #4
NeoPa
32,556 Expert Mod 16PB
There is already a (built-in) function to do the job (at least the fundamentals of it).
Split Function


Description

Returns a zero-based, one-dimensional array containing a specified number of substrings.

Syntax

Split(expression[, delimiter[, limit[, compare]]])

The Split function syntax has these named arguments:

Part Description
expression Required. String expression containing substrings and delimiters. If expression is a zero-length string(""), Split returns an empty array, that is, an array with no elements and no data.
delimiter Optional. String character used to identify substring limits. If omitted, the space character (" ") is assumed to be the delimiter. If delimiter is a zero-length string, a single-element array containing the entire expression string is returned.
limit Optional. Number of substrings to be returned; –1 indicates that all substrings are returned.
compare Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values.
As the function returns an array it is not usable from within a query (or SQL) so VBA would be required to do the job.
Jan 30 '07 #5

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

Similar topics

26
by: Kai Jaensch | last post by:
Hello, i am an newbie and i have to to solve this problem as fast as i can. But at this time i don´t have a lot of success. Can anybody help me (and understand my english :-))? I have a...
2
by: G.Gerard | last post by:
Hello Does anyone know how to get an entire memo field to be displayed in a combo box drop down list? Example - if the memo field contains the following : This is a test to see if
2
by: Gary Lynch | last post by:
I am looking for a simple solution to a recurrent problem with imported data in Access 97. The example below is a simplification of a problem with a much larger database. Let's say I start out...
5
by: Geoff Portbury | last post by:
I'm a swimming club coach. I have a data base for recording times at various meets. I have a FORM for entering times called SWIM TIMES. When I enter the swimmers name ID, eg FOR01 for Doug Ford I...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
1
by: Montana_Trader | last post by:
I have a product database that includes a memo field for product descriptions. That database must be imported into a legacy system that has four text fields for product descriptions, each with a...
3
by: salad | last post by:
I have an A97 application that is NOT split on a network. It is used by 15+ folks continually. It is quick and fast. I split it several years ago and had to merge it together again after the...
6
by: jacc14 | last post by:
Good morning all. I have been working on a database for the past couple of weeks and it is pretty nippy. I have an ODBC link in there from another software program. Since splitting it and...
2
by: iritchie | last post by:
*(Apologies, I posted this in the SQL Server forum first) Hello all, I am trying to write a query which breaks down a single address field into individual fields, with char(10) or a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.