G
Guest
Here is a summary of what I need help with. I have the following:
tblECR
ECRID - PK
ECRNumber - Text
tblECN
ECNID - PK
ECRsSelected - Text (listbox)
On the form "frmECN" I have an unbound listbox that does a query on tblECR
and lists all the ECRNumber entries into the listbox. I also have a listbox
on frmECN called ECRsSelected. Finally, I have a commandbutton that
"Copies" multiple values selected from the first listbox to the second
listbox (ECRsSelected). The code works in that I can get multiple selections
to the ECRsSelected listbox. The only problem is that it only stores the
first item and none of the others. I looked at the ECRsSelected field in the
actual table and it only shows one value. There is something missing from my
code. I cannot identify why I cannot get multiple values to be stored in the
ECRsSelected field in the table. Also, I need to clear the second listbox
(ECRsSelected) for the next record.
Here is my code. PLEASE HELP SOON. I have to show this to client by COB
Friday.
Dim ctrlListBox As ListBox
Dim FRM As Form, CTL As Control
Dim varitem As Variant
Dim strSQL As String
Set FRM = Forms![frmECN]
Set CTL = FRM!ECRNumber
Dim DB As Database
Set DB = CurrentDb
Set ctrlListBox = FRM!ECRsSelected
For Each varitem In CTL.ItemsSelected
ctrlListBox.AddItem Item:=CTL.ItemData(varitem)
Next
Thanks
Ben
tblECR
ECRID - PK
ECRNumber - Text
tblECN
ECNID - PK
ECRsSelected - Text (listbox)
On the form "frmECN" I have an unbound listbox that does a query on tblECR
and lists all the ECRNumber entries into the listbox. I also have a listbox
on frmECN called ECRsSelected. Finally, I have a commandbutton that
"Copies" multiple values selected from the first listbox to the second
listbox (ECRsSelected). The code works in that I can get multiple selections
to the ECRsSelected listbox. The only problem is that it only stores the
first item and none of the others. I looked at the ECRsSelected field in the
actual table and it only shows one value. There is something missing from my
code. I cannot identify why I cannot get multiple values to be stored in the
ECRsSelected field in the table. Also, I need to clear the second listbox
(ECRsSelected) for the next record.
Here is my code. PLEASE HELP SOON. I have to show this to client by COB
Friday.
Dim ctrlListBox As ListBox
Dim FRM As Form, CTL As Control
Dim varitem As Variant
Dim strSQL As String
Set FRM = Forms![frmECN]
Set CTL = FRM!ECRNumber
Dim DB As Database
Set DB = CurrentDb
Set ctrlListBox = FRM!ECRsSelected
For Each varitem In CTL.ItemsSelected
ctrlListBox.AddItem Item:=CTL.ItemData(varitem)
Next
Thanks
Ben