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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving records from one table to another

Status
Not open for further replies.

THWatson

Technical User
Apr 25, 2000
2,601
CA
I have two tables. One is for &quot;Current members&quot;. The other is for &quot;Removed Members&quot;.<br><br>Originally, these were all in one &quot;Members&quot; table, and there is a Removed column to identify those no longer current. <br><br>With two separate tables, is there a way that if the Removed column is filled in, the record is automatically deleted from the &quot;Current Members&quot; table and placed in the &quot;Removed Members&quot; table?<br>Tom
 
You will need to code it in VBA.<br><br>You should use the event OnChange for the field Removed.<br>I think this code should work. If not, check the syntax, because I did not test it.<br><br>dim db as DAO.database<br>dim recs as DAO.recordset<br>set db = CurrentDb()<br>set recs = db.OpenRecordset("<i>TableName</i>") 'destination table<br><br>if Removed then<br>  with recs<br>    .AddNew<br>    !<i>FieldName</i>=<i>FieldName</i> 'dest=source<br>    .<br>    .<br>    .<br>    .<br>    .Update<br>  end with  <br>end if
 
1. Create the second table where your Removed records will be . <br>2.Create&nbsp;&nbsp;an append query to append all records from the first table to the second&nbsp;&nbsp;&nbsp;&nbsp;table criteria should be( removed is not null for the removed Column) run this query<br>3.Create a delete Query(To delete all record from The first table That are marked removed in the Deleted column)<br><br><br>Contact me on :<br><br><A HREF="mailto:nkabirwa@netscape.net">nkabirwa@netscape.net</A><br><br>&nbsp;for any additional explanation<br> <p>Nkabirwa Sowed Magezi<br><a href=mailto:nkabirwa@netscape.net>nkabirwa@netscape.net</a><br><a href= > </a><br>A Ugandan Developer for<br>
(1) School Management Information System(SMIS) - Foxpro 2.6 ; Ms-Acess 97<br>
(2)Debt onitoring System(DMS) - Ms-Acess 97<br>
(3) The Loans Recovery System(LS) - Ms- Access 97<br>
(4) The Dry Cleaners System(DS) - Ms- Access 97
 
HIM and Magezi<br>Thanks! I'll try both methods.<br>Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top