Copy Record From One Table To Another

crow

Registered User.
Local time
Today, 03:01
Joined
Jan 10, 2005
Messages
22
In this form I have simply 2 list boxes. The first gets its data from table1. The second is to get its data from table2. In both of these tables there is only one field. In table1 there is a list of 200 songs. What I would like to be able to do is double click on any entry in my first list box and have it copy to table2 so it will be displayed in my second list box in the order that it was clicked in. So what it is doing is copying the entry from one table to the other and displaying it in a list box in real time. This form is going to be used to create a setlist for the band I play in. Does anyone know how this could be done. I've tried many functions within Access with NO success. Any help would be welcomed! :eek:
 
The playlist table needs a second column to be used to order the list. Physical order has no meaning in a relational database. So add an autonumber column and make it the primary key. There is no need to worry about the assigned values. They will ONLY be used to sort the playlist.

Create a form with two subforms. The first subform will show the available songs. The second will show the playlist. Add a button to the form which runs a query that deletes the current contents of the playlist table. Add a second button that prints a report of the playlist.

In the doubleclick event of the song name control on the first subform, add DAO or ADO code to append a row to the playlist table. You only need to append the song name, Access will generate the autonumber value. If you look up append in help or here, you'll find examples.

If you want to delete songs from the play list table, add code to the doubleclick event to delete the selected record. Look up delete in help for examples.

In the report, use the sorting and grouping options to order by the autonumber field.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom