Would like Selected Row to have a memory

  • Thread starter Thread starter p
  • Start date Start date
P

p

I have a massive continuous view table that is viewed in a form. When I
selected a particular row I have another button which launches the edit
form of that particular record.

When I close the edit - it automatically requeries the table and the
focus of the row goes to the very top row.

Is there an easy way for the table to stick to one row while I edit its
contents in another form?
 
P,

"Requery" does not change your current record in a form - "Refresh" does.
What is you code when close the "edit form" ?

Regards/JK
 
uh i dont want to sound stupid.. but don't you have that flat-out
backwards?

-Aaron
 
Requerying the form does reload it, so the form does return to the first
row.

Save the primary key value into a variable.
Then FindFirst that value in the RecordsetClone of the form after the
Requery.

This kind of thing:

Dim rs As DAO.Recordset
Dim varID as Variant
If Me.Dirty Then
Me.Dirty = False
End If
varID = Me.[ID]
Me.Requery
If IsNull(varID) Then
RunCommand acCmdRecordsGotoNew
Else
Set rs = Me.RecordsetClone
rs.FindFirst "[ID] = " & varID
If rs.NoMatch Then
MsgBox "Oops."
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
 
I stand corrected, Allen

Allen Browne said:
Requerying the form does reload it, so the form does return to the first
row.

Save the primary key value into a variable.
Then FindFirst that value in the RecordsetClone of the form after the
Requery.

This kind of thing:

Dim rs As DAO.Recordset
Dim varID as Variant
If Me.Dirty Then
Me.Dirty = False
End If
varID = Me.[ID]
Me.Requery
If IsNull(varID) Then
RunCommand acCmdRecordsGotoNew
Else
Set rs = Me.RecordsetClone
rs.FindFirst "[ID] = " & varID
If rs.NoMatch Then
MsgBox "Oops."
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

JK said:
P,

"Requery" does not change your current record in a form - "Refresh" does.
What is you code when close the "edit form" ?

Regards/JK
 

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

Back
Top