A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combining two fields in a table



 
 
Thread Tools Display Modes
  #1  
Old February 19th, 2010, 01:28 AM posted to microsoft.public.access.gettingstarted
BARRY
external usenet poster
 
Posts: 383
Default Combining two fields in a table

I have a 5-digit zip field and a 4-digit plus-4 field. I created in my table
a 10 digit newzip field, so that combining these two make a 9-digit zip that
looks like this:
60016-2345. I have no problem creating this in a query, but I want this to
be in a table, and then I will delete the existing zip and the plus field,
then re-name the newzip as zip. How do I do this? Can I convert it from the
query into a table? I know this is basic, but I'm really new to this
--
Barry
  #2  
Old February 19th, 2010, 03:24 AM posted to microsoft.public.access.gettingstarted
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Combining two fields in a table

On Thu, 18 Feb 2010 17:28:01 -0800, Barry
wrote:

I have a 5-digit zip field and a 4-digit plus-4 field. I created in my table
a 10 digit newzip field, so that combining these two make a 9-digit zip that
looks like this:
60016-2345. I have no problem creating this in a query, but I want this to
be in a table, and then I will delete the existing zip and the plus field,
then re-name the newzip as zip. How do I do this? Can I convert it from the
query into a table? I know this is basic, but I'm really new to this


I would suggest opening the table in design view and creating a new 10-byte
text field (ZipNew call it, perhaps).

Run an Update query updating it to

[Zip] & "-" & [Plus4]

If your fields are Number fields rather than Text, use

Format([Zip], "00000") & "-" & Format([Plus4], "0000")

using yor own fieldnames of course.

Check the data, open the table in design view, delete the old zip and plus4
fields and rename Zipnew to Zip; you will probably want to Compact the
database when you're done.

Do you need to allow for non-US postal codes, say from Canada? If so you may
want to check the size; Canadian postcodes are 6 or 7 characters (depending on
if you include the blank), other countries are quite variable.

--

John W. Vinson [MVP]
  #3  
Old February 19th, 2010, 04:01 AM posted to microsoft.public.access.gettingstarted
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Combining two fields in a table

You need an update query, so open in design view and pull down the new field
to the grid.
Click on the Update icon and the rows of the grid change to have one titled
'Update To:' in which you enter --
[Zip] &"-" & [Plus-4]

Run the query.

--
Build a little, test a little.


"Barry" wrote:

I have a 5-digit zip field and a 4-digit plus-4 field. I created in my table
a 10 digit newzip field, so that combining these two make a 9-digit zip that
looks like this:
60016-2345. I have no problem creating this in a query, but I want this to
be in a table, and then I will delete the existing zip and the plus field,
then re-name the newzip as zip. How do I do this? Can I convert it from the
query into a table? I know this is basic, but I'm really new to this
--
Barry

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:57 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.