The user selects a customer, a sales area and then between 1 and 3
products. On the press of a form button, I want to append to the link
table between 1 and 3 records depending upon the number of products
selected.
Here is the code I am using;
Dim ctlList As Control, varItem As Variant
Dim rst As Recordset, db As Database
Set db = CurrentDb
Set rst = db.OpenRecordset("tblCustomerAreaProductLinks")
Set ctlList = Forms!frmAssignEnquiries!lstProducts
' Enumerate through selected items.
For Each varItem In Me.lstProducts.ItemsSelected
rst.AddNew
rst!fldProductID = ctlList.ItemData(varItem)
rst!fldCustomerID = Me!cboSelectCustomer
rst!fldSalesAreaID = Me!cboSelectArea
rst.Update
Next varItem
rst.Close
This doesn't work and the database just seems to go into an
interminable loop. I am a fairly experienced novice at code (!!!) but
I am stuck. Am I on the right track here or is there a simpler way to
achieve my objective?
Gordon