Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Requery Dilemma

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-12-05 : 08:02:56
Gary writes "In Access2000 - frontend, SQL - backend, I have a form and a subform. The
form contains data specific to an order that we received inclusive of a
DueDate. (The DueDate is automatically generated once certain criteria have
been met.) There are certain instances when the DueDate has to be changed.
Therfore, I created a command button which takes the user to the subform.
The subform allows the user to change the DueDate + / - a specified number
of days. The enter a reason why the date is being changed then exit the
subform and return to the main form which is still open.

My dilemma is that once I exit the subform, I need the main form to update
the DueDate with the new date established in the subform, and I don't want
the user to have to search to locate the job they just changed. I believe
this can be done as a Re-query, but my knowledge of re-querying is limited.
Is the requery done in the sub-form or the main form? What is the structure
of the code used? Please help.

Thanks
Rookie"

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-12-05 : 09:02:15
If I hear you right, i think you are saying the problem is on the main form, they are perhaps in Record #3.

Then, they open a subform, change some values, and close it.

Then, they are back at the main form. But, changes in the subform are not reflected. So, to get those changes, you say:

Me.Requery

But -- that then puts the user back on the first record in the table, and then they have to manually go back to the record where they were. Very ugly indeed!

If that's right -- the answer is:

Instead of just requerying the main form, try this:

dim CurrRec as long
CurrRec = me.currentrecord
me.requery
docmd.gotorecord acDataForm, Me.Name, acGoTo, CurrRec

That should save the current record #, do a requery on the form, and put you right back there. Try it, let me know if it helps.

There's also a bookmark property of the form that may work better as well -- you can save it into a variant i believe, requery, and then go BACK to that bookmark. read help for more info.



- Jeff
Go to Top of Page
   

- Advertisement -