Strange "Mystery Record" Behavior

W

William Wisnieski

Hello Everyone:

I'm having a very strange problem occurring with my Access 2000 database. I
call it the "mystery record."

Here's the story:

I have a query by form that returns a record set in a datasheet. The user
double clicks on a row in that datasheet and a main form (pop up) opens
bound to a table with a continuous subform bound to a query.

The user can move through this recordset via a Next and Previous command
button on the main form. Everything works fine except for the "mystery
record". When you click on the Next or Previous button, it will move to the
correct record in the recordset, however the first record of the main form
table is temporarily displayed. And by temporarily I mean it flashes for a
second or so before it moves to the correct Next or Previous record.

I've tried adding DoCmd.Echo False to my Next and Previous command button
but that didn't work. Here's the code in the Next Button:

Private Sub cmdNext_Click()
Dim rst As DAO.Recordset

On Error Resume Next

Set rst = Forms("frmSearch").sfrmSearchResults.Form.Recordset

rst.MoveNext

If rst.EOF Then
MsgBox "End of records. Close this form to search again.",
vbOKOnly, "Search"
rst.MoveLast
Exit Sub
End If

Me.FilterOn = False
Me.Filter = "StudentID=" & rst.Fields(0)
Me.FilterOn = True

Set rst = Nothing

End Sub

Any ideas on this wierd behavior? Should I put additional code in the
OnCurrent Event of the Main Form?

Thanks,

William
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top