Mark A Matte
markamatte at hotmail.com
Tue Jan 2 13:56:25 CST 2007
Hello All, This is just an FYI to the problem below. I found that there is trouble using the below code when referring to a subform. Researching MS knowledgebase I found the suggestion of using "GoToControl" in conjunction with "GoToRecord": DoCmd.GoToControl "sfrmView" DoCmd.GoToRecord , , acFirst Me!cboStatus.SetFocus Forms!frmview!sfrmView.Requery Forms!frmview!sfrmNotes.Requery Exit Sub NoRecord: Forms!frmview!sfrmView.Requery Forms!frmview!sfrmNotes.Requery This seems to work...thanks for the assistance. Mark A. Matte >From: "Mark A Matte" <markamatte at hotmail.com> >Reply-To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >To: accessd at databaseadvisors.com >Subject: Re: [AccessD] ERROR going to first record Sometime? >Date: Tue, 02 Jan 2007 15:41:12 +0000 > >Gustav, > >I made a mistake in my explanation. The subform is NOT filtered...it is >requeried because records have been updated and may need to be >included/excluded when the combo changes. So I believe I need requery. > >Thanks, > >Mark A. Matte > > > >From: "Gustav Brock" <Gustav at cactus.dk> > >Reply-To: Access Developers discussion and problem > >solving<accessd at databaseadvisors.com> > >To: <accessd at databaseadvisors.com> > >Subject: Re: [AccessD] ERROR going to first record Sometime? > >Date: Tue, 02 Jan 2007 16:26:12 +0100 > > > >Hi Mark > > > >I think all you need is not to Refresh the subform but to Requery it. > > > >/gustav > > > > >>> markamatte at hotmail.com 02-01-2007 16:14 >>> > >Hello All, > > > >I'll try to ask this a simple as possible. I have a form in A97 that has >a > >combo box and a subform. The subform is continuos and is filtered >anytime > >the combo is updated. If I was on the 4th record on the subform and I > >changed the combo...when the sub refreshed it would also be on the 4th > >record. I needed to go back to the first record each time. So I added >the > >code below: > > > >Dim rs As DAO.Recordset > >Set rs = sfrmView.Form.RecordsetClone > >rs.MoveFirst > >sfrmView.Form.Bookmark = rs.Bookmark > >NoRecord: > >Set rs = Nothing > >********** > >This works fine if I move to a different record each time before changing > >the combo. If I just change the combo I get an error during the refresh >of > >the subform "Runtime error 3020, Update or CancelUpdate without AddNew or > >Edit". The line of code is on the 'Form_BeforeUpdate' of the subform. >If > >I > >use the code above...What would I add to determine if I were already on >the > >first record...or what are other approaches to the same solution? > > > >Thanks and Happy New Year, > > > >Mark A. Matte > > > > > >-- > >AccessD mailing list > >AccessD at databaseadvisors.com > >http://databaseadvisors.com/mailman/listinfo/accessd > >Website: http://www.databaseadvisors.com > >_________________________________________________________________ >The MSN Entertainment Guide to Golden Globes is here. Get all the scoop. >http://tv.msn.com/tv/globes2007/ > >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com _________________________________________________________________ Find sales, coupons, and free shipping, all in one place! MSN Shopping Sales & Deals http://shopping.msn.com/content/shp/?ctid=198,ptnrid=176,ptnrdata=200639