To answer the first Question:
Private Sub Button_Click()
Dim prm_MyCtl As Control
Dim VarItm
Dim DBS As Database
Dim rst As Recordset
Set prm_MyCtl = Me![MyList]
If prm_MyCtl.ItemsSelected.Count = 0 Then
Beep
MsgBox "No Item Selected", 48
Exit Sub
End If
Set DBS = CodeDb
Set rst = DBS.openrecordset("Select * From MyTable")
' run through all selected items
For Each VarItm In prm_MyCtl.ItemsSelected
rst.addnew
rst!FieldName = prm_MyCtl.Column(0) ' just choose the location of the
field in the list start with 0
rst.update
Next
End Sub
====================================
To answer the second Question:
Private Sub Button_Click()
Dim prm_MyCtl As Control
Dim VarItm, MyCount as integer
Dim DBS As Database
Dim rst As Recordset
Set prm_MyCtl = Me![MyList]
MyCount = 1
If prm_MyCtl.ItemsSelected.Count = 0 Then
Beep
MsgBox "No Item Selected", 48
Exit Sub
End If
Set DBS = CodeDb
Set rst = DBS.openrecordset("Select * From MyTable")
rst.addnew
' run through all selected items
For Each VarItm In prm_MyCtl.ItemsSelected
rst("FieldName" & MyCount) = prm_MyCtl.Column(0) ' just choose the
location of the field in the list start with 0
MyCount =MyCount +1 ' To get the next field num
Next
rst.update
End Sub
JW said:
I'm trying to set up a form with a list box to have a user select a few lines
of data. Once all of the selections are made, I'd like to append this data
to a table, which feeds a "data entry" form. Does anyone have any ideas?
The other issue is that all selections need to be appended to one row of
data in the table. For example, selection 1 goes to Field 1, selection 2
goes to Field 2.
Thank you.