Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do a mass replace

Status
Not open for further replies.

Chucklez

Programmer
Jul 25, 2002
104
US
A little background first.

I have 2 tables I am presently working with.
The first is a 'temporary' table. I will call this tblInvTemp
The second is a 'master' table. I wil call this one tblInvMaster.
Both tables have the exact same structure, and almost 160 fields.

When I want to add a new record to the master record, I first write it to the temp table, display the information for the user to confirm the information, and upon confirmation, write it to the master table. I am doing this using DAO 3.6.

I really dont want to write each individual field in my addnew command. Is there a way I can just mass transfer the data?

Rather than this:
tblInvTemp.addnew
tblInvTemp!strProductID = tblInvMaster!strProductID
tblInvTemp!memDescript = tblInvMaster!memdescript
...
another 160 times
tblInvTemp.update

Is there some way like this?:
tblInvTemp.addnew
tblInvTemp!* = tblInvMaster!*
tblInvTemp.update

Thanks for any help or ideas you can give,
Chuck
 
Alternatively, You could write it directly into the master table and on your form add two buttons: one saves the record the other initiates an undo command.

HTH
Rich
Lead Developer
 
Hi Chuck!

Use an append query like this:

INSERT INTO TblInvMaster
SELECT TblInvTemp.*
FROM TblInvTemp;


You can run this query and every thing from TblInvTemp will be appended to TblInvMaster. Of course, you will need to delete everything from TblInvTemp every time, but I figured you were doing that already.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Actually, I didnt give yall enough info, but.....
I think I have figured it out. After I posted my question it occured to me to use a append query. Tell me what you guys think of my logic.

the purpose of this is to let a user select a prexisting inventory item, (This item is actually a kit, or in better terms, a bunch of items put together that you use to complete 1 finished item) copy it to a new name, and add/change some items as needed.

So what I did was set up a select query that will pull the kit's item number from a textbox on my form, and deposit (via an append query with the select query as my control source) all information from the table into my temp table. From there the user can change some of the items that are inside this kit.

Once the user presses the continue button, an append query pulls all of the info out of the temp tables, and places it into the master table. I then delete all info in the temp table.

SO thats where Im at now. I appreciate everyones help in this, and if anyone has any ideas on how to make this better, lemme know.
thanks
chuck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top