Avatar of Nev Garven
Nev Garven
Flag for New Zealand

asked on 

Updating records selected in a multi select simple List box

Hi everyone,

My first question.  

On form, frmAddBuyer, is a field containing the buyerID (PK in tblBuyer), for the current buyer.

I have two listboxes on the form.  The first multi-select listbox shows the books currently in stock and available to be bought, based on tblSale.  The table name might be a bit misleading, but all books entered into the database are added to tblSale.

The 2nd listbox shows the the books that have been bought by the current buyer.

There is a combo box on the form, that filters the books, based on the bookID.

What I need to happen after I have selected multiple books in the first listbox, is click on my Add Purchase button, and have the selected books move across to the 2nd list box, and have both listboxes refresh.  The selected books in the first listbox will no longer be shown as available and in stock.

The rowsource for the first listbox is: SELECT [qryKawProductAvailable].[BookID], [qryKawProductAvailable].[SaleID], [qryKawProductAvailable].[BookName] FROM qryKawProductAvailable ORDER BY [SaleID];   The bound column is column 1.

The rowsource for the 2nd listbox is:  SELECT [qryKawProductAllocated].[buyerID], [qryKawProductAllocated].[BuyerTrademeName], [qryKawProductAllocated].[BookID], [qryKawProductAllocated].[BookName], [qryKawProductAllocated].[SaleID], [qryKawProductAllocated].[BookInStock], [qryKawProductAllocated].[AuthorType] FROM qryKawProductAllocated ORDER BY [buyerID];   The bound column is column 1.

I'm thinking when the button is clicked, it opens a recordset based on tblSale, and the books selected in the first listbox.  As it cycles through each record, it inserts the buyerid into the buyerid field, and changes the bookInStock field to No.

Sorry for any confusion...!
Microsoft Access

Avatar of undefined
Last Comment

8/22/2022 - Mon