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  

Copy Field Data



 
 
Thread Tools Display Modes
  #1  
Old June 26th, 2009, 02:55 AM posted to microsoft.public.access.gettingstarted
Roger Bell
external usenet poster
 
Posts: 275
Default Copy Field Data

I have a data base that has two memo fields containing data. I need to copy
the data from one memo field to the other. Is there a way I can do this
rather than have to copy and paste each record, as there are over 17,000
records?

Thanks for any help
  #2  
Old June 26th, 2009, 03:30 AM posted to microsoft.public.access.gettingstarted
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Copy Field Data

"Roger Bell" wrote in message
news
I have a data base that has two memo fields containing data. I need to
copy
the data from one memo field to the other. Is there a way I can do this
rather than have to copy and paste each record, as there are over 17,000
records?



You mean you have a *table* with two memo fields, and you want to copy the
contents of one of the fields to the other, for every record in the table?

Why?

The way to do this would be to run an update query, using SQL along the
lines of this model:

UPDATE YourTable SET MemoField2 = MemoField1

Of course, you need to change names to your table and fields.

But I recommend you verify that that this is really what you want to do, and
make a backup before you do it.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #3  
Old June 26th, 2009, 03:56 AM posted to microsoft.public.access.gettingstarted
Roger Bell
external usenet poster
 
Posts: 275
Default Copy Field Data

Thanks Dirk for your prompt reply. I have inherited a data base with two
separate memo fields and the Data in one memo field needs to be ADDED to the
other memo field and then the defunct field removed. If I use the Update
query as you kindly suggested, then the contents of the field are replaced.
Is there a way I can copy the contents of 1 field to the other?

Thanks for your understanding and patience

"Dirk Goldgar" wrote:

"Roger Bell" wrote in message
news
I have a data base that has two memo fields containing data. I need to
copy
the data from one memo field to the other. Is there a way I can do this
rather than have to copy and paste each record, as there are over 17,000
records?



You mean you have a *table* with two memo fields, and you want to copy the
contents of one of the fields to the other, for every record in the table?

Why?

The way to do this would be to run an update query, using SQL along the
lines of this model:

UPDATE YourTable SET MemoField2 = MemoField1

Of course, you need to change names to your table and fields.

But I recommend you verify that that this is really what you want to do, and
make a backup before you do it.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


  #4  
Old June 26th, 2009, 04:12 AM posted to microsoft.public.access.gettingstarted
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Copy Field Data

"Roger Bell" wrote in message
news
Thanks Dirk for your prompt reply. I have inherited a data base with two
separate memo fields and the Data in one memo field needs to be ADDED to
the
other memo field and then the defunct field removed.


Now he tells me!

If I use the Update
query as you kindly suggested, then the contents of the field are
replaced.


Yes, that's right.

Is there a way I can copy the contents of 1 field to the other?


Sure. The only question is whether you want to insert some sort of
delimiter between the original text and the copied text. To simply append
the field contents without a delimiter:

UPDATE YourTable
SET MemoField2 = MemoField2 & MemoField1
WHERE MemoField1 Is Not Null

If you want to insert a space between them (but only if the target field is
not Null):

UPDATE YourTable
SET MemoField2 = (MemoField2 + " ") & MemoField1
WHERE MemoField1 Is Not Null

If you want to insert a new line between them (but only if the target field
is not Null):

UPDATE YourTable
SET MemoField2 = (MemoField2 + (Chr(13) & Chr(10))) & MemoField1
WHERE MemoField1 Is Not Null

Note: in the last two queries above, I've used the trick that (Null +
"string") yields Null, while (Null & "string") yields "string".

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #5  
Old June 26th, 2009, 05:10 AM posted to microsoft.public.access.gettingstarted
Roger Bell
external usenet poster
 
Posts: 275
Default Copy Field Data

Thanks again Dirk. Thanks to you I used the Update with the space command
and it worked to a point. I notice that some fields did not have the data
transferred when I ran the query. Do you have any idea why this may have
happened , as there was no error message when I ran the Query?

I appreciate your valuable time

"Dirk Goldgar" wrote:

"Roger Bell" wrote in message
news
Thanks Dirk for your prompt reply. I have inherited a data base with two
separate memo fields and the Data in one memo field needs to be ADDED to
the
other memo field and then the defunct field removed.


Now he tells me!

If I use the Update
query as you kindly suggested, then the contents of the field are
replaced.


Yes, that's right.

Is there a way I can copy the contents of 1 field to the other?


Sure. The only question is whether you want to insert some sort of
delimiter between the original text and the copied text. To simply append
the field contents without a delimiter:

UPDATE YourTable
SET MemoField2 = MemoField2 & MemoField1
WHERE MemoField1 Is Not Null

If you want to insert a space between them (but only if the target field is
not Null):

UPDATE YourTable
SET MemoField2 = (MemoField2 + " ") & MemoField1
WHERE MemoField1 Is Not Null

If you want to insert a new line between them (but only if the target field
is not Null):

UPDATE YourTable
SET MemoField2 = (MemoField2 + (Chr(13) & Chr(10))) & MemoField1
WHERE MemoField1 Is Not Null

Note: in the last two queries above, I've used the trick that (Null +
"string") yields Null, while (Null & "string") yields "string".

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


  #6  
Old June 26th, 2009, 02:06 PM posted to microsoft.public.access.gettingstarted
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Copy Field Data

"Roger Bell" wrote in message
...
Thanks again Dirk. Thanks to you I used the Update with the space command
and it worked to a point. I notice that some fields did not have the data
transferred when I ran the query. Do you have any idea why this may have
happened , as there was no error message when I ran the Query?



Please post the exact SQL of the query you ran.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #7  
Old June 27th, 2009, 06:39 AM posted to microsoft.public.access.gettingstarted
Roger Bell
external usenet poster
 
Posts: 275
Default Copy Field Data

The following is the SQL, where the Table is called b

UPDATE b SET Bapt_note = (Bapt_Note + " ") & Conf_Note
WHERE Conf_Note Is Not Null;

Thanks again


"Dirk Goldgar" wrote:

"Roger Bell" wrote in message
...
Thanks again Dirk. Thanks to you I used the Update with the space command
and it worked to a point. I notice that some fields did not have the data
transferred when I ran the query. Do you have any idea why this may have
happened , as there was no error message when I ran the Query?



Please post the exact SQL of the query you ran.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #8  
Old June 27th, 2009, 08:03 AM posted to microsoft.public.access.gettingstarted
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Copy Field Data

"Roger Bell" wrote in message
...
The following is the SQL, where the Table is called b

UPDATE b SET Bapt_note = (Bapt_Note + " ") & Conf_Note
WHERE Conf_Note Is Not Null;



Roger, I can't believe that that SQL statement could fail to update any
record where the Conf_Note field isn't Null. If you think it didn't, could
you please verify that you aren't being misled by, for example, a new-line
in the field.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 




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 09:37 PM.


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