Hello,
I have a continuous form based on a table (tblRKM_Halifax_CA_2010) and a subform (subfrmAppend) based on the same table. The linked fields are Recno - therefore, the subform displays and allows edits on the record that is clicked on the continuous form.
All is working well, but I have noticed when stepping through my subform OnCurrent event that the event fires 3 times when I click a record on the parent form. Can anyone tell me why and if there is a way to prevent this from happening? It is not causing any errors, but the screen flickers 3 times every time I click on a blank record (in order to add a new entry) and that is annoying. I am providing the code for the OnCurrent event of the subform below:
Private Sub Form_Current()
If IsNull(Recno) Then
Dim lngRecno2 As Long
glngmRecno = 1 + DMax("[Recno]", "tblRKM_Halifax_CA_2010")
lngRecno2 = glngmRecno - 8
Forms!frmRKM_Halifax_CA_2010!subfrmAppend!Recno.SetFocus
Recno = glngmRecno
Forms!frmRKM_Halifax_CA_2010.Requery
DoCmd.GoToRecord , , , lngRecno2
DoCmd.GoToRecord , , acLast
End If
End Sub
NB - the event fires 3 times even if it does not enter the if-then loop.
Thanks in advance,
Rudra
I have a continuous form based on a table (tblRKM_Halifax_CA_2010) and a subform (subfrmAppend) based on the same table. The linked fields are Recno - therefore, the subform displays and allows edits on the record that is clicked on the continuous form.
All is working well, but I have noticed when stepping through my subform OnCurrent event that the event fires 3 times when I click a record on the parent form. Can anyone tell me why and if there is a way to prevent this from happening? It is not causing any errors, but the screen flickers 3 times every time I click on a blank record (in order to add a new entry) and that is annoying. I am providing the code for the OnCurrent event of the subform below:
Private Sub Form_Current()
If IsNull(Recno) Then
Dim lngRecno2 As Long
glngmRecno = 1 + DMax("[Recno]", "tblRKM_Halifax_CA_2010")
lngRecno2 = glngmRecno - 8
Forms!frmRKM_Halifax_CA_2010!subfrmAppend!Recno.SetFocus
Recno = glngmRecno
Forms!frmRKM_Halifax_CA_2010.Requery
DoCmd.GoToRecord , , , lngRecno2
DoCmd.GoToRecord , , acLast
End If
End Sub
NB - the event fires 3 times even if it does not enter the if-then loop.
Thanks in advance,
Rudra