Dear experts -
I have a form with 2 list boxes - the left is items that are not selected (i.e., not in a given join table) and the list box on the right contains those that are. The list boxes populate correctly.
I have two buttons, one right-arrow and one left-arrow button, which are used to 'move' items from one list box to another (basically creating a SQL string that inserts or deletes items from the join table).
The code below works find - but only the FIRST time it is run. after that, it generates an error, namely "error 3420: object invalid or no longer set".
The offending line of code is the last line of the following, namely: db.Execute strSQL, dbFailOnError
Any ideas? When I check the strSQL variable, it looks fine to my eye...
' Add each Language selected in the "Available" list box.
For Each varItem In .ItemsSelected
strSQL = _
"INSERT INTO LanguageLists_Join (LanguageList_ID, LanguagePlusLocale_ID) VALUES (" & _
Me.txtID & ", " & .ItemData(varItem) & ")"
db.Execute strSQL, dbFailOnError