Copy all records shown in lstSrc to lstDest

bulrush

Registered User.
Local time
Today, 15:09
Joined
Sep 1, 2009
Messages
209
Access 2003 on Win XP.

I have a form. This form has 2 list boxes: lstSearch holds all possible records in a table called "MM". lstDest holds records the user chose out of lstSearch, and is linked to a table "tmpMM".

I have 3 combo boxes used to limit the records in lstSearch. The user chooses values in the 3 combo boxes, and the number of records in lstSearch is filtered accordingly. (The RowSource of lstSearch is changed.)

I have a command button called "Add All" which is supposed to add all records (after filtering via combo boxes) from lstSearch to lstDest. I thought there might be an SQL statement to copy records from one table to another but I'm not that familiar with SQL. How can I copy all the records shown in lstSearch to lstDest with one button click?

Thank you.

NOTE: changing a combo box changes the RowSource of lstSearch. I tried this code, which wanted to copy ALL records, not just the ones shown in lstSearch.
For i = 1 To lstSearch.ListCount
lstDest.AddItem (lstSearch.ItemData(i))
Next i

' Do this last.
lstDest.Requery
lblDestCnt.Caption = lstDest.ListCount & " items"
 
Last edited:

Users who are viewing this thread

Back
Top Bottom