Form problem, going back to first record

Miller84

Registered User.
Local time
Today, 13:54
Joined
Nov 18, 2004
Messages
18
Hi,

After I run a requery command in an Afterupdate event (to update a second subform), the subform in my main form refreshes and returns me to the very first record in the main form. How do make sure that after the requery or refresh, the form keeps me on that record?
 
There could be several issues here - My first shot would be to try a refresh instead of a requery...

kh
 
Your using the wrong method, you need to reference the subform correctly
Forms!Form1.Form. etc Requery, use the code builder to obtain the correct syntax
 
Requery does exactly what it says - it runs the underlying query AGAIN. That will position you at the beginning of the recordset. When you want to requery a control's RowSource or a subForm's RecordSource, be specific

Me.SomeCombo.Requery - requeries the combo
Me.SomeSubform.Requery - requeries a subform
Me.Requery - requeries the mainform and everything contained within it.

When you want to save the current record, DO NOT use requery as some members suggest. The correct method is:
DoCmd.RunCommand acCmdSaveRecord

this command saves the current record without any side effects since it doesn't do anything else as requery does.
 
Where do I put that command then? Does that command save the record in subform AND update subform2 at the same time? Its essential that subform 2 is updated after an addition to subform 1 has been made.
 

Users who are viewing this thread

Back
Top Bottom