Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listboxes and appending into a table

Status
Not open for further replies.

robertc

MIS
Sep 30, 2000
2
CA
Dear All,<br><br>I have a list box in a form which displays all the options that a user can choose from.  They can select all, clear all, or choose individual options.  I have gotten the select all and clear all, but now i am having trouble appending what the user selects to a table.  I need to loop through the list options and check if it is selected, and then need to append a new record for each option that is chosen. Here is the code that I have gotten so far.<br><br> Dim rstOrder As Recordset<br>    Dim rstOptions As Recordset<br>    Dim intI As Integer<br><br>    Dim j As Integer<br>    <br><br>    ' Return reference to current database.<br>    <br>    strSQL = "SELECT * FROM tblOrderOptions"<br>    Set rstOrder = db.OpenRecordset(strSQL)<br>    With Me!lstOptions<br>        For intI = 0 To .ListCount - 1         ' CaN I     loop this way??<br>            If (.Selected(intI) = True) Then     'Can I check this way?<br>             With rstOrder<br>             .AddNew<br>             !OrderNumber = OrderNumber    'This is on form<br>             !SpecNumber = cboSpecNumber   'This is on form<br>             !Option = ???                'WHat do I do here?<br>             .Update<br>             End With<br>            End If<br>            <br>        Next intI<br>    End With<br>    <br>    rstOrder.close<br>    Set db = Nothing<br><br>Please help, this is the last of it. Thanks.  If you know of any other solutions please let me know.<br><br>Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top