T
Terry
I have a subform in a mainform frm_MKT_Client_Register.
The following is part of a command button click event which moves the
subform onto the next record then requeries a listbox on the mainform. The
problem I get is when the code is run the requery of the mainform listbbox
requeries the subform and moves it to the beginning of the recordset.
There is a proviso, the code only performs as above when the whole
application is running, not when the form is opened on its own from the
database container. There is nothing in the subform OnCurrent event and
nothing runs in the mainform OnCurrent event.
Regards
Set rs = Me.RecordsetClone
With rs
.MoveLast
lngCount = .RecordCount
.FindFirst "[IDContact]=" & Me.IDContact & ""
lngRecNo = (.AbsolutePosition + 1)
' OK to move
If (lngRecNo = lngCount) Then
' Already at end of recordset
Else
' Move next
.MoveNext
lngRecNo = (.AbsolutePosition + 1)
End If
Me.Bookmark = .Bookmark
DoEvents
Me.lblFormStatus.Caption = "Viewing " & lngRecNo & _
" of " & lngCount & " Contacts."
DoEvents
.Close
End With
Set rs = Nothing
Forms!frm_MKT_Client_Register.Controls!txtContactPointer =
Me.IDContact
Dim ctl As Control
Set ctl = Forms!frm_MKT_Client_Register.Controls!lstProjectList
ctl.SetFocus
ctl.Requery **************
Set ctl = Nothing
The problem I have is that if the
The following is part of a command button click event which moves the
subform onto the next record then requeries a listbox on the mainform. The
problem I get is when the code is run the requery of the mainform listbbox
requeries the subform and moves it to the beginning of the recordset.
There is a proviso, the code only performs as above when the whole
application is running, not when the form is opened on its own from the
database container. There is nothing in the subform OnCurrent event and
nothing runs in the mainform OnCurrent event.
Regards
Set rs = Me.RecordsetClone
With rs
.MoveLast
lngCount = .RecordCount
.FindFirst "[IDContact]=" & Me.IDContact & ""
lngRecNo = (.AbsolutePosition + 1)
' OK to move
If (lngRecNo = lngCount) Then
' Already at end of recordset
Else
' Move next
.MoveNext
lngRecNo = (.AbsolutePosition + 1)
End If
Me.Bookmark = .Bookmark
DoEvents
Me.lblFormStatus.Caption = "Viewing " & lngRecNo & _
" of " & lngCount & " Contacts."
DoEvents
.Close
End With
Set rs = Nothing
Forms!frm_MKT_Client_Register.Controls!txtContactPointer =
Me.IDContact
Dim ctl As Control
Set ctl = Forms!frm_MKT_Client_Register.Controls!lstProjectList
ctl.SetFocus
ctl.Requery **************
Set ctl = Nothing
The problem I have is that if the