From: elias on 2 Mar 2010 22:09 G'day Everyone, I have a couple if situations in my database where data is being entered into a subforms. There is two similar situations I'm faced with which make our user interface a bit nasty. WHAT I'M DOING: -> A subform needs to be re-sorted as new records are entered, (after update event) -> A calculated control on the main form needs to be requeried/ recalc(ed) from the Subform afterupdate. When issuing commands requery commands in the subform afterupdate event, everything works sweet, except the subform record pointer reverts to the top record of the subform after the requery, and moves itself out of add record mode. The irritation is that when you need to enter 10 or 20 new records into the Subform, after the requery command in afterupdate event, the active record pointer keep resetting up to the the top of the subform records COMMANDS BEING USED: Me.Parent!ControlName.Requery (To requery to control on the main form) or Me.Requery (To resort the current Subform, to put the new record in a special sort order Does anyone suggestion how I can work around this behavior? One final thing, regarding the Refreshing/Requery the main form issue, I understand it's possible to get the main form controls to refer to the subform, however there are reasons why I prefer in this case to refresh/requery the main form rather than the other way around. So, Can this be done? Refresh/Requery the Subform and/or Mainform (from within the Subform) while continuing to stay in Data Add-Record type mode, and continually add records to the subform unhindered by the resetting of the current-record pointer? Thanks for listening! Elias Farah.
From: Tom van Stiphout on 2 Mar 2010 22:30 On Tue, 2 Mar 2010 19:09:50 -0800 (PST), elias <elias.farah(a)scw.com.au> wrote: That subform behavior is by design. So you simply save the PK before you requery, and set the record selector back after it: dim orderID as Long orderID = Me.OrderID 'save the PK Me.Requery with Me.RecordsetClone .FindFirst "OrderID=" & orderID Me.Bookmark = .Bookmark end with -Tom. Microsoft Access MVP >G'day Everyone, > >I have a couple if situations in my database where data is being >entered into a subforms. There is two similar situations I'm faced >with which make our user interface a bit nasty. > >WHAT I'M DOING: >-> A subform needs to be re-sorted as new records are entered, (after >update event) >-> A calculated control on the main form needs to be requeried/ >recalc(ed) from the Subform afterupdate. > >When issuing commands requery commands in the subform afterupdate >event, everything works sweet, except the subform record pointer >reverts to the top record of the subform after the requery, and moves >itself out of add record mode. > >The irritation is that when you need to enter 10 or 20 new records >into the Subform, after the requery command in afterupdate event, the >active record pointer keep resetting up to the the top of the subform >records > >COMMANDS BEING USED: >Me.Parent!ControlName.Requery (To requery to control on the main >form) >or >Me.Requery (To resort the current Subform, to put the new record in a >special sort order > >Does anyone suggestion how I can work around this behavior? > >One final thing, regarding the Refreshing/Requery the main form issue, >I understand it's possible to get the main form controls to refer to >the subform, however there are reasons why I prefer in this case to >refresh/requery the main form rather than the other way around. > > >So, Can this be done? Refresh/Requery the Subform and/or Mainform >(from within the Subform) while continuing to stay in Data Add-Record >type mode, and continually add records to the subform unhindered by >the resetting of the current-record pointer? > >Thanks for listening! > > >Elias Farah.
|
Pages: 1 Prev: help with field list in query Next: Open ACCESS Application thru C# Application on windows 7 |