PC Review


Reply
Thread Tools Rate Thread

How can I enter data in one field based upon that in another?

 
 
=?Utf-8?B?UGhpbCBD?=
Guest
Posts: n/a
 
      28th Feb 2006
I created a field years ago which contains City and State together, i.e,
Dallas, TX. (okay, bad move, I know)... But now with thousands of records I
want to seperate this information correctly by having one field for city and
another for state.

I will smply rename the "city state" field to "CITY" and create a new field
for "ST." Easy enough. The question is how to populate the new field with
the new data without physically typing in "CTRL and ("), record after record.


Earlier posts don't seem to answer this. Help & thanks.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmVycnkgV2hpdHRsZQ==?=
Guest
Posts: n/a
 
      28th Feb 2006
For this to work, each record much have a comma ( , ) in your city state
field. Fix any records without one. Also make a backup of the table or,
better yet, entire database, first.

Run something like the following in a query. Make sure that you are using
the proper field names. If it returns what you want, you can then use them in
an update query once you add the State field.

Cities: Left([CityState],InStr(1,[CityState],",")-1)

States: Trim(Mid([CityState],InStr(1,[CityState],",")+1))
--
Jerry Whittle
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"Phil C" wrote:

> I created a field years ago which contains City and State together, i.e,
> Dallas, TX. (okay, bad move, I know)... But now with thousands of records I
> want to seperate this information correctly by having one field for city and
> another for state.
>
> I will smply rename the "city state" field to "CITY" and create a new field
> for "ST." Easy enough. The question is how to populate the new field with
> the new data without physically typing in "CTRL and ("), record after record.
>
> Earlier posts don't seem to answer this. Help & thanks.

 
Reply With Quote
 
=?Utf-8?B?UGhpbCBD?=
Guest
Posts: n/a
 
      28th Feb 2006
Sorry, amateur here. Let's see if I have it:
New Query - Design
Choose the table
Column one using citystate enter your string below "Cities"
Then Column two using new ST field enter your the other string "States"
When I try this get an Invalid Procedure Call

"Jerry Whittle" wrote:

> For this to work, each record much have a comma ( , ) in your city state
> field. Fix any records without one. Also make a backup of the table or,
> better yet, entire database, first.
>
> Run something like the following in a query. Make sure that you are using
> the proper field names. If it returns what you want, you can then use them in
> an update query once you add the State field.
>
> Cities: Left([CityState],InStr(1,[CityState],",")-1)
>
> States: Trim(Mid([CityState],InStr(1,[CityState],",")+1))
> --
> Jerry Whittle
> Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
>
> "Phil C" wrote:
>
> > I created a field years ago which contains City and State together, i.e,
> > Dallas, TX. (okay, bad move, I know)... But now with thousands of records I
> > want to seperate this information correctly by having one field for city and
> > another for state.
> >
> > I will smply rename the "city state" field to "CITY" and create a new field
> > for "ST." Easy enough. The question is how to populate the new field with
> > the new data without physically typing in "CTRL and ("), record after record.
> >
> > Earlier posts don't seem to answer this. Help & thanks.

 
Reply With Quote
 
=?Utf-8?B?SmVycnkgV2hpdHRsZQ==?=
Guest
Posts: n/a
 
      1st Mar 2006
Hi,

Make double sure that the table's column is spelt CityState. If not, such as
looking like City State with a space, change where I put CityState to match
in all 4 places. I didn't put in the space in my examples.
--
Jerry Whittle
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Phil C" wrote:

> Sorry, amateur here. Let's see if I have it:
> New Query - Design
> Choose the table
> Column one using citystate enter your string below "Cities"
> Then Column two using new ST field enter your the other string "States"
> When I try this get an Invalid Procedure Call
>
> "Jerry Whittle" wrote:
>
> > For this to work, each record much have a comma ( , ) in your city state
> > field. Fix any records without one. Also make a backup of the table or,
> > better yet, entire database, first.
> >
> > Run something like the following in a query. Make sure that you are using
> > the proper field names. If it returns what you want, you can then use them in
> > an update query once you add the State field.
> >
> > Cities: Left([CityState],InStr(1,[CityState],",")-1)
> >
> > States: Trim(Mid([CityState],InStr(1,[CityState],",")+1))
> > --
> > Jerry Whittle
> > Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
> >
> > "Phil C" wrote:
> >
> > > I created a field years ago which contains City and State together, i.e,
> > > Dallas, TX. (okay, bad move, I know)... But now with thousands of records I
> > > want to seperate this information correctly by having one field for city and
> > > another for state.
> > >
> > > I will smply rename the "city state" field to "CITY" and create a new field
> > > for "ST." Easy enough. The question is how to populate the new field with
> > > the new data without physically typing in "CTRL and ("), record after record.
> > >
> > > Earlier posts don't seem to answer this. Help & thanks.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enter info in one sheet, auto enter in another based on one field =?Utf-8?B?VGhlIEJ1c3lIaWdoTGlnaHRlcg==?= Microsoft Excel New Users 1 1st Aug 2007 10:54 PM
Enter data based on data from another field. =?Utf-8?B?TGxveWQ=?= Microsoft Access 3 31st Oct 2006 09:30 PM
Enter Data into a field automatically depending on data entered in previous field JackieM Microsoft Access Database Table Design 3 27th Apr 2006 04:53 PM
Enter data in one field of subform based on combo box selection(or checkbox?) sarajane_d@yahoo.com Microsoft Access Forms 1 9th Jan 2006 08:04 PM
enter value based on drop down list of another field? =?Utf-8?B?ZWNhcm5lczA3MjM=?= Microsoft Excel Misc 2 15th Oct 2004 03:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:06 PM.