Question : Reset of displayed form when "requery" is performed

I have a form that displays several rows in a sub-form.  I have a function that allows the user to update the displayed data.  There is so much data in the sub-form that the vertical scrolling occurs.  In order to display the updated data I invoke a requery function (via DoCmd.Requery).  Unfortunately, after the invocation, the form is reset and the place in the sub-form loses the scroll place of the line of the update.

Is there any way to avoid resetting the layout of the form and sub-forms upon invoking the requery command?

Answer : Reset of displayed form when "requery" is performed

i know what you mean. i would recommend changing the  the design of your form. create a link between two unbound subforms. some say it cant be done but it can. after you do this you will be able to refresh and re-query.


create a new form
insert a text box -- name it "txtLink"
on the form insert two sub-forms

lets name them: subformA  and subformB


subformA will be your "main" display while subformB will contain a list of the records with a brief description/pic.

(make sure you set the control sources to your subforms)
also set subformB to be a continuous form. subformA should be set at single view

ok this gets a little hairy--

right click on the text box you created - set the control source to one of the fields in subformB (for example the ID/autogen number field.) use one that has unique data.
(use the expression builder to do this) it will end up being something like
=me.subformB!forms![yourfield]

after you have done that you will know you did it right if when you click on a record in subformB the text/number in your textbox will change.

now go to the properties of subformA
here we will set the parent and child fields.         *(do not set these in subformB)

you have to type these in manually if you click on the "..." in the fields an error will come up saying you cant do it.

in the parent block type in the name of your textbox we made earlier.   "txtLink"
the data has to match so
because the "txtlink" controlsource is set to the ID field in subformB
the child block should be the id field in subformA  which should be something like "ID"

following these steps will make you able to link two "unbound forms" and when you click on a record in subfromB subformA will goto that record.


i hope that wasnt too much info let me know if you need clarity. i hope this isnt as clear as mudd. i do not have access to ms access on this computer but i will be at work in the morning and if you need i can clarify.

hope this helps

good luck












Random Solutions  
 
programming4us programming4us