Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

After update, form goes back to 1st record

Status
Not open for further replies.

hairwormman

Programmer
Dec 9, 2003
22
0
0
US
I am working in Access 2002. I have a dropdown menu within a form (master form). Items to this menu can be added by the user if the appropriate choice is not available, by clicking a button below the dropdown menu. Clicking this button will open another form (menu form) containing the list of items in the dropdown list, to which a choice can then be added. When the user is done, the menu form closes; the options on the dropdown menu within the master form are updated to include the newly added item. This all works flawlessly, EXCEPT that upon returning to the master form (after closing the menu form) the user is always returned to the first record (regardless of with which record the user started) of the master form. The odd thing is that after the menu form closes, the master form is still at the same record number as when the user started, but when the user clicks anywhere on the master form, it returns to record 1. The user then has to manually go back to the record to which the menu choice was being added.
I would like for the master form to stay at the record, to which the user is actually trying to change the dropdown menu choice.
Any help is appreciated. Thanks!!!!
 
very strange problem, have you checked all code that is running when you clsoe your MEnu form? You should look over everything to ensure there isn't some sort of movefirst method being called, or that you aren't performing some strange action. Out of curiosity, when the user enters the new menu item, then returns to the main for, how do you go about updating the list on the main form?
 
JimbOne, thanks for your input.
The way I update the dropdown list (after making an addition), is that on exit from the "menu form" I run a macro with a requery action.
I just went through all the code and the only things running after exiting the "menu form" are in the following macro:

1. Close: "menu form"
2. Requery: with a blank control name.

When I add a Gotorecord statement within this macro for "go to =50", once user clicks back in the "master form" it goes to record 50. However, if I put "forward +1" it will go to record 2. So, for some reason the program defaults to go to record 1. Any other suggestions? Thanks!!
 
I think you have kind of answered your own question. By not selecting a control to requery (see the little help text down to the right when you've selected the requery action), you requery the "object" - here the form. A requery (of a form) will also "move" to the first record of the form's recordset.

If the issue here is just to update the rowsource of the combo, then put in the combos name in the control name part of the requery action.

Should you still need to requery the whole form, and be able to "stay on the same record", that's also doable, but I think coding would be required. Then post back.

HTH Roy-Vidar
 
You were right. Adding the combo's name into the control name part of the requery action did the trick. I did not know that a requery of a form would cause the form to "reset" to the first entry.
Thanks!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top