[AccessD] Recordsource running before Open Event

Erwin Craps Erwin.Craps at ithelps.be
Mon Jul 21 09:57:08 CDT 2003


I use a do while loop and check if form is closed or not....
In this loop a doevents is needed...

-----Oorspronkelijk bericht-----
Van: jcolby at colbyconsulting.com [mailto:jcolby at colbyconsulting.com] 
Verzonden: maandag 21 juli 2003 14:00
Aan: Access Developers discussion and problem solving
Onderwerp: RE: [AccessD] Recordsource running before Open Event


What do you use when you want a modal form.  Opening a form modal stops
code running behind the form open code, which is a useful trick when you
want to requery a combo when the form closes (for example).

I actually built a class to process openargs and place them in a list in
the openargs class.  Then the form can ask the openargs class for the
arguments back when it's done loading and ready to go to work.  My form
class loads the openargs class as part of it's initialization.

John W. Colby
www.colbyconsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Erwin Craps
Sent: Monday, July 21, 2003 4:59 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Recordsource running before Open Event



I personaly never use openargs...(anymore)
I believe they are from an old generation Access and they have a
shortcoming on the length... (2000 something or is it 256 something.)

Two ways to solve this...

Use a class property in your form.

Or set a form.control from where you call the code and then run a public
declared function in your form.

The class has my preference.
I found myself dabble around with these openargs, etc until I discovered
classes in and out forms. I felt in love with classess, but they do tend
to generate more work in the beginning.

Erwin


-----Oorspronkelijk bericht-----
Van: David Emerson [mailto:davide at dalyn.co.nz]
Verzonden: maandag 21 juli 2003 3:04
Aan: dba-SQLServer at databaseadvisors.com; ACCESS-L at PEACH.EASE.LSOFT.COM;
accessd at databaseadvisors.com
Onderwerp: [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


_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list