G
Guest
I have two listboxes.
One listbox populates the 2nd listbox.
What I am trying to do is to populate the values in the 2nd listbox to
append the values in the listbox, and also another value in a text box as a
new record in a particular table. I have made several posts, but have not
received any replies. Hope I haven't been blacklisted for asking too many
questions. I am starting to wrap up my project, but I need to make some
modifications to my forms. Initially I had a form with 40 combo boxes, but
based on suggestion from this group, I decided to go with the two listbox ,
command buttons route, which was a smarter/ neater approach..
Here is my code from my Form_Load
Private Sub Form_Load()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String, strItem As String
strSQL = "SELECT ControlNumber FROM tblSopNumbers"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
Do Until rs.EOF
strItem = rs.Fields("ControlNumber").Value
Me.lstControlNumbers.AddItem strItem 'Row Source type must be Value List
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
The problem I am having is that some times the user may have to populate 15
columns in a table, and sometimes he/she may have to populate more.
Example - A particular batch may require that an employee be trained on 15
modules, while another batch may require the employee be trained on 25.
Any additional information will be provided, if needed.
FYI - I used the "How to use AddItem and RemoveItem to move selections from
one list box to another" from http://support.microsoft.com/kb/278378/;
to create my listboxes.
One listbox populates the 2nd listbox.
What I am trying to do is to populate the values in the 2nd listbox to
append the values in the listbox, and also another value in a text box as a
new record in a particular table. I have made several posts, but have not
received any replies. Hope I haven't been blacklisted for asking too many
questions. I am starting to wrap up my project, but I need to make some
modifications to my forms. Initially I had a form with 40 combo boxes, but
based on suggestion from this group, I decided to go with the two listbox ,
command buttons route, which was a smarter/ neater approach..
Here is my code from my Form_Load
Private Sub Form_Load()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String, strItem As String
strSQL = "SELECT ControlNumber FROM tblSopNumbers"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
Do Until rs.EOF
strItem = rs.Fields("ControlNumber").Value
Me.lstControlNumbers.AddItem strItem 'Row Source type must be Value List
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
The problem I am having is that some times the user may have to populate 15
columns in a table, and sometimes he/she may have to populate more.
Example - A particular batch may require that an employee be trained on 15
modules, while another batch may require the employee be trained on 25.
Any additional information will be provided, if needed.
FYI - I used the "How to use AddItem and RemoveItem to move selections from
one list box to another" from http://support.microsoft.com/kb/278378/;
to create my listboxes.