bodylojohn
Registered User.
- Local time
- , 23:58
- Joined
- Dec 28, 2005
- Messages
- 205
Hello people...
I have a main form called frmCALCULATIE.
On that mainform there is a subform called frmCALCULATIEVERSIE
On the form frmCALCULATIEVERSIE there is also a subform called frmCALCULATIEREGEL.
Besides the subform frmCALCULATIEVERSIE there is another subform on the main form which is a datasheet where I put the following code:
Except for the code in bold it works perfect. the record is added to the right table with the correct data.
However...after the requery the the datasaet goes to the first record but I wont it to go to the current record.
The code in bold is not working. What am I doing wrong?
I have a main form called frmCALCULATIE.
On that mainform there is a subform called frmCALCULATIEVERSIE
On the form frmCALCULATIEVERSIE there is also a subform called frmCALCULATIEREGEL.
Besides the subform frmCALCULATIEVERSIE there is another subform on the main form which is a datasheet where I put the following code:
Code:
Private Sub AddNew()
'Dim newID As Long
Dim rst As dao.Recordset
'add a record
Set rst = CurrentDb.OpenRecordset("SELECT CalculatieRegel_ID, CalculatieVersie_ID, Werkzaamheden_ID, Eenheid_ID FROM tblCALCULATIEREGEL;")
With rst
.AddNew
!Werkzaamheden_ID = Me.txtElement_ID.Value
!CalculatieVersie_ID = Forms![frmCALCULATIE]![frmCALCULATIEVERSIE].Form![txtCalculatieVERSIE_ID].Value
!Eenheid_ID = Me.txtEenheid_ID.Value
.Update
.Close
End With
'requery the form
Forms![frmCALCULATIE].Requery
[B]With Forms![frmCALCULATIE]![frmCALCULATIEVERSIE].RecordsetClone
.FindFirst "CalculatieVersie_ID = " & Forms![frmCALCULATIE]![frmCALCULATIEVERSIE].Form![txtCalculatieVERSIE_ID].Value
End With[/B]
End Sub
Except for the code in bold it works perfect. the record is added to the right table with the correct data.
However...after the requery the the datasaet goes to the first record but I wont it to go to the current record.
The code in bold is not working. What am I doing wrong?