Bill,
I have the code working that creates a new record in the subform, but
currently there's a problem because two records get created instead of one. I
think I know why it happens so I'm trying to find a solution. Anyway, the
code I'm using to create record from ListBox selections is as follows:
Dim rs As Recordset, db As Database, sql As String
Dim SelectedItem As Variant, count As Integer
sql = "Select * From Main"
Set db = CurrentDb
Set rs = db.OpenRecordset(sql, dbOpenDynaset)
count = 1
For Each SelectedItem In lstAdmin.ItemsSelected
rs.AddNew
rs![EmpID] = Me.cboEmp_Name.Value
rs![ManagerID] = Me.cboJob_Title.Value
rs![DeptID] = Me.cboDept.Value
rs("Doc_Number") = Me.lstAdmin.Column(0, SelectedItem)
If Not IsNull(Me.txtNotes) And count < 2 Then
rs("Notes") = Me.txtNotes.Value
End If
count = 2
rs.Update
Next
rs.Close
Set db = Nothing
Set rs = Nothing
The code does what it's supposed to do, but when I look inside the main
table I see the new record data, and just above it another record with
partial data filled in. That's a big problem for me right now. Can't figure
out why that's happening :-(
-Simon