F
FlyBoy
I've read all the posts, went to all the suggested sites, and tried all the
sample code. I know I'm dense, but I still can't get a multiselct list box to
store values in the table I want.
Using A2003 on XPPro, I have one table, tblImpacts linked 1toMany to another
table, tblImpactedProjects via the tblImpacts PK, EntryID (autonumber) to
tblImpactedProjects EntryID (number).
The main entry form frmImpactEntry is bound to tblImpacts. This is the code
I'm trying to use:
Dim rst As Recordset
Dim strItems As String
Dim strItems2 As String
Dim LstItem As String
Dim intCurrentRow As Integer
Set rst = CurrentDb().OpenRecordset("ImpactedProjects")
' Get the list box selections
For intCurrentRow = 0 To List0.ListCount - 1
'Is selected?
If List0.Selected(intCurrentRow) Then
'Get value
LstItem = List0.Column(0, intCurrentRow)
'Add to Table
rst.AddNew
rst("ImpactedProjects") = LstItem
rst.Update
'Build list for msgbox
'strItems = strItems & LstItem & vbCrLf
'Build list for 2nd box
'strItems2 = strItems2 & LstItem & ";"
End If
Next intCurrentRow
rst.Close
Thanks in Advance
sample code. I know I'm dense, but I still can't get a multiselct list box to
store values in the table I want.
Using A2003 on XPPro, I have one table, tblImpacts linked 1toMany to another
table, tblImpactedProjects via the tblImpacts PK, EntryID (autonumber) to
tblImpactedProjects EntryID (number).
The main entry form frmImpactEntry is bound to tblImpacts. This is the code
I'm trying to use:
Dim rst As Recordset
Dim strItems As String
Dim strItems2 As String
Dim LstItem As String
Dim intCurrentRow As Integer
Set rst = CurrentDb().OpenRecordset("ImpactedProjects")
' Get the list box selections
For intCurrentRow = 0 To List0.ListCount - 1
'Is selected?
If List0.Selected(intCurrentRow) Then
'Get value
LstItem = List0.Column(0, intCurrentRow)
'Add to Table
rst.AddNew
rst("ImpactedProjects") = LstItem
rst.Update
'Build list for msgbox
'strItems = strItems & LstItem & vbCrLf
'Build list for 2nd box
'strItems2 = strItems2 & LstItem & ";"
End If
Next intCurrentRow
rst.Close
Thanks in Advance