David Emerson
davide at dalyn.co.nz
Mon Jul 21 20:46:26 CDT 2003
Thanks for everyone's suggestions. (Sorry about the multiple posts - I think my emailer had a fit of the giggles). In the end I just trapped the error in the Form_Current event. At 21/07/2003, you wrote: >David, >I would place the >Me.InputParameters >in a different form that is kept always kept open but hidden >For example >forms!frmSystem!InputParameters >Then reference that control in your sql statement giving the >recordsource...... > >Regards >Borge > >----- Original Message ----- >From: "David Emerson" <davide at dalyn.co.nz> >To: <dba-SQLServer at databaseadvisors.com>; <ACCESS-L at PEACH.EASE.LSOFT.COM>; ><accessd at databaseadvisors.com> >Sent: Monday, July 21, 2003 11:04 AM >Subject: [AccessD] Recordsource running before Open Event > > > > Groups, > > > > I have the following code in the Open event of a form - > > > > If Me.OpenArgs <> "All" Then > > Me.InputParameters = Me.OpenArgs <- Form_Current event > > triggers here > > Me.RecordSource = "spfrmGeneralJournal" > > Else > > Me.RecordSource = "spfrmGeneralJournal" > > End If > > > > The problem is that the "Me.InputParameters = Me.OpenArgs" triggers the > > Form's Current event. This is a problem because in there it checks for >the > > value of a field and because the Recordsource hasn't been defined yet it > > generates an error. The reason that the record source is not defined >until > > in the Open Event is because the front end is linked to an SQL B/E and the > > table that is the source has over 55,000 records which is taking over 5 > > seconds to open. This is opened, then the Open event is fired to produce > > the reduced record set (in effect the sproc is being run twice). > > > > Does anyone have a method for opening the form without the Current event > > being triggered before the open event is completed? (Or preventing the > > sproc being run before the Open event is processed)? > > > > > > Regards > > > > David Emerson > > DALYN Software Ltd > > 25b Cunliffe St, Johnsonville > > Wellington, New Zealand > > Ph/Fax (877) 456-1205 > > > > _______________________________________________ > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > >_______________________________________________ >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com Regards David Emerson DALYN Software Ltd 25b Cunliffe St, Johnsonville Wellington, New Zealand Ph/Fax (877) 456-1205