I have code that works to insert items chosen in a list box added to a table.
Now I want to add to that code instructions to also pull the date from a text box on the form and insert that into the table.
I have the code to do it, but I am not sure where to add it into the existing code.
I have added it before the instructions for the list box, but then it only adds the item from the list box to the table. If I add it after the instructions for the list box, it only adds the date.
I don't know why, but only the second instruction ends up working.
Here is the code for moving the item from the list box:
Private Sub btnAddSelected_Click()
Dim frm As Form
Dim ctl As Control
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim i As Variant
Set frm = Forms("frm_Act_Enter")
Set ctl = frm![lstPrevRpts]
Set db = CurrentDb
Set rst = db.OpenRecordset("Act_SubTo_Date")
For Each i In ctl.ItemsSelected
Debug.Print i, ctl.Column(4, i)
rst("ActID") = ctl.Column(4, i)
Set rst = Nothing
Here is the piece of code I want to add:
rst!ActDate.Value = Nz(Me!ActDate.Value, Date)
Can someone tell me where to put this?