Form flicker with requery to bookmark

K

Kirk Wilson

How can I stop a form from flickering when I do a requery returning to a
bookmark?

I have an open form. I pop up a form to add or modify some data. I set a
bookmark, close the pop up form, , do a requery, and then move to the
bookmark. You can see the main form flicker during the requery.
 
A

Allen Browne

You could turn Echo off.

Not sure using a bookmark over a Requery is a good idea. IIRC, the Requery
reloads the form, so the previous recordset is no longer valid, and
therefore the bookmark would not be valid either? Might be safer to
FindFirst the primary key value again after the Requery.
 
K

Kirk Wilson

Thanks for the echo tip. Below is the code I finalized. I'm not sure your
second comment applies.

Private Sub CloseForm_Click()
On Error GoTo Err_CloseForm_Click

Dim rs As Object
Dim objMainForm As Object
Dim lngAddress As Long

Set objMainForm = Forms!Edit_Customer
Set rs = objMainForm.Recordset.Clone

lngAddress = Me!Address

DoCmd.Close
Application.Echo False

Forms!Edit_Customer.Requery

rs.FindFirst "[Record_id#] = " & lngAddress
objMainForm.Bookmark = rs.Bookmark
rs.Close
Set rs = Nothing

Application.Echo True

Exit_CloseForm_Click:
Exit Sub

Err_CloseForm_Click:
MsgBox Err.Description
Resume Exit_CloseForm_Click

End Sub
 

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