Hi guys,
thanks everyone for your response!
Problem is solved!
Bruce, you was right, I dont need this:
CODE
rst("workerID").Value = Me!cboWorker.Column(0)
The reason why I need 18 records all the time in subform take a look of pictures. Its like some kid of excel looking form.
fkegley, you was right, I needed my own autonumber like unbound texbox, and other fields also unbound but subform is bound.
Unbound texboxes takes values from Main form and OnOpen event they get inserted into table with INSERT INTO command. For autonumber I just used Dmax+1.
Here's a whole code, but field names are not on English.
CODE
Private Sub Form_Open(Cancel As Integer)
Dim rnSQL As String
Dim intZaposleni, intMesec, intGodina, intOrgJed As Integer
Dim intrListID As Integer
Me!rListID.Value = DMax("rListID", "tblRadneListe") + 1
intrListID = Me!rListID.Value
Me!cboZaposleni = Forms!frmRadneListeMeni!txtZaposleni.Value
Me!cboMesec = Forms!frmRadneListeMeni!txtMesec.Value
Me!cboGodina = Forms!frmRadneListeMeni!cboGodina.Value
intZaposleni = Me!cboZaposleni.Column(0)
intMesec = Me!cboMesec.Column(0)
intGodina = Me!cboGodina.Column(0)
intOrgJed = Me!cboOrgJed.Column(0)
rnSQL = "INSERT INTO tblRadneListe (ZaposleniID,MesecID,GodinaID,OrgJedID,rListID) SELECT " & intZaposleni & ", " & _
"" & intMesec & ", " & intGodina & ", " & intOrgJed & "," & intrListID & ""
DoCmd.RunSQL rnSQL
SubFormUpdate
End Sub
CODE
Private Function SubFormUpdate()
Dim rst As DAO.Recordset
Dim i As Long
Dim updSQL As String
Dim lkup As Integer
Dim rnSQL As String
Set rst = Me!frmDaniSubform.Form.Recordset
If Me!frmDaniSubform.Form.Recordset.RecordCount = 0 Then
For i = 0 To 18
rst.AddNew
rst("vrstaRadaID").Value = i + 1
rst("rListID").Value = Me!rListID
rst.Update
Next i
Set rst = Nothing
End If
Me!frmDaniSubform.Form.Enabled = True
Me!frmDaniSubform.Form.AllowAdditions = False
End Function
But if I want make changes I just made same form just with Bound fields.
Thanks everyone for help!