Add new

S

Scott

I have 2 tables tbl1 and tbl2 that has the same structure, and I want to
move the data from tbl1 to tbl2 using rsttbl2.AddNew and to copy all fields
from tbl1 to the newely added record in tbl2, without having to define each
field in rsttbl2; for example:

rsttbl2!field1 = Some Text
rsttbl2!field2 = Some Text
rsttbl2!field3 = Some Text
rsttbl2!field4 = Some Text
rsttbl2!field5 = Some Text
rsttbl2!field6 = Some Text

So I want to avoid the above and just say

rsttbl2!AllFields = rsttbl1!AllFields

Is there any way how to do that. ?


Thanks


Scott
 
D

Douglas J. Steele

No, there isn't.

To be honest, it sounds suspect to me to have to store identical duplicate
data.

If you really do, though, can you use an Append query instead (INSERT INTO
tbl2 SELECT * FROM tbl1 WHERE ....)?

Another option is:

For intLoop = 0 To (rsttbl1.Fields.Count - 1)
rsttbl2.Fields(intLoop) = rsttbl1.Fields(intLoop)
Next intLoop
 
S

Scott

Yes, you are right, and I will use the Append query, it's
much easier than the second option, and I'll use a delete
query after that to delete the record from tbl1.

Thanks


Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top