P
prairie smoke
I am using the ItemsSelected collection to move the selections in a listbox
to a one-column table. In looking at examples in books, etc., this code
looks close, but no "prize." The code produces error 3219: Invalid
Operation. I don't quite get how to move several choices to the table. The
code is below. Thanks for any suggestions you can offer.
Prairie Smoke
Dim db As Database
Dim frm As Form, ctl As Control, tbl As TableDef
Dim varItm As Variant, fld As Field
Set db = CurrentDb()
Set frm = Forms!frmQueryGenerator
Set fld = db!tblFunction_Code!gl_code
Set ctl = frm!lstFunctionNumber
For Each varItm In ctl.ItemsSelected
fld = ctl.ItemsSelected(varItm)
Next varItm
End Sub
to a one-column table. In looking at examples in books, etc., this code
looks close, but no "prize." The code produces error 3219: Invalid
Operation. I don't quite get how to move several choices to the table. The
code is below. Thanks for any suggestions you can offer.
Prairie Smoke
Dim db As Database
Dim frm As Form, ctl As Control, tbl As TableDef
Dim varItm As Variant, fld As Field
Set db = CurrentDb()
Set frm = Forms!frmQueryGenerator
Set fld = db!tblFunction_Code!gl_code
Set ctl = frm!lstFunctionNumber
For Each varItm In ctl.ItemsSelected
fld = ctl.ItemsSelected(varItm)
Next varItm
End Sub