Continuous form: recall position after requery - URGENT!

J

jtertin

I have a subform that is a continuous form which displays 100
records. I have insert and delete buttons on each line of the
continuous form that execute a SQL stored procedure that updates the
table that the data is being pulled from and THEN requeries the
continuous form to update the displayed information to reflect the
updated SQL table.

My question: When the form requeries, it is brought back to the top.
How can I keep the form focused on the same row set after a row is
inserted or deleted? i.e. how can I reference the location at which
the row was inserted or deleted and how can I determine which record
(iteration of the continuous form) is focussed on when the form
requeries?

THANK YOU!!!
 
K

kingston via AccessMonster.com

Is there an ID field available in the continuous form? If so, create a
variable and set it equal to the ID. Run the SQL and requery the form. Then
locate the original record by finding the ID stored by the variable:

DoCmd.GoToControl "IDControlName"
DoCmd.FindRecord variable
 
J

jtertin

I just found a way to do it before you posted. For future reference:

Create a hidden column or text field holding a row ID

After Requerying the form:

Me.Recordset.Move [HiddenIDTextbox].Value

I am sure this could also be done with a variable, but since I have
more than one function calling for this ID value, and I am not
familiar with Global variables in Access, this provided an easy way to
do it.

Thank you for your input!
 

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