Open Form with instance method & wait to close? (1 Viewer)

ChrisO

Registered User.
Local time
Tomorrow, 03:51
Joined
Apr 30, 2003
Messages
3,202
Joe.

This is what I still don’t understand from your first post:-
>>With a docmd.openform, I could use the openargs property, but that prohibits me from opening multiple instances of this form.<<

To me, ‘opening multiple instances’ means opening multiple instances concurrently. If you only ever have one instance open at any one time then there should be no need to instantiate the form but simply open it in the normal fashion. (One exception to that general rule is when a Form is opened as a subform because that Form is instantiated even if it is the only copy opened. However that does not apply here.)

Therefore, to me, it is implied that if there is a need to open more than one instance of the Form concurrently then it would imply you are trying to open more than one Report concurrently.

So this would be my question; are you trying to open more than one Report at a time?

Chris.
 

April15Hater

Accountant
Local time
Today, 13:51
Joined
Sep 12, 2008
Messages
349
Nigel, Oh if only InputBox had Data Validation...I suppose I could build the DV into the code, and loop until they get it right and/or parse/format, but I don't know, something just rubs me the wrong way about doing it like that, and I can't quite put my finger on it.

Good catch Chris... It's been a while since i've looked at it, so I'm going off of memory here, but my idea was to have the capability of opening two separate reports (i.e. rptSummary and rptDetail) simultaneously (or two of the same report for that matter). Ideally, load the form on report open passing in the report name maybe as a property or even openargs. After user parameter entry (say Date or Date Range), pass those parameters into the report being opened. Having said that, I think I see where you are going with this: if I wanted to open two of the same report, I would need to instantiate those reports as well.

That leads me to another question: When a user opens a report from the Database Menu, is it being instantiated, or is it an instance of docmd.openreport?

Thinking about this now, I wonder if I could call the form withevents inside the report class? Argh, now I want to get back on that project!
 
Last edited:

nanscombe

Registered User.
Local time
Today, 18:51
Joined
Nov 12, 2011
Messages
1,082
I did offer the other option of a modal popup form, which could have data validation built in, and the use of global variables to pass the data around. :)

From Access 2007 onwards you also have the Tempvar object to hold data.
 
Last edited:

ChrisO

Registered User.
Local time
Tomorrow, 03:51
Joined
Apr 30, 2003
Messages
3,202
Joe.

The sample in post #17 can already opens two different Reports concurrently using a Date picker. I have not tried to open two instances of the same Report the same way.

But it would require the Reports to be opened in a non-dialog fashion because the first Report opened would prevent the second Report from being opened.

Opening a Report from the database window opens the Report, it does not instantiate it.

Chris.
 

ChrisO

Registered User.
Local time
Tomorrow, 03:51
Joined
Apr 30, 2003
Messages
3,202
Well, there does appear to be the syntax for instantiating Reports.

Dim ThisReport As Report_Report1

Then you will run into the problem of instantiating the Report by name, which also happens with Forms.

There are two methods of overcoming that problem with Forms.

The first is to have a select case structure of all the Forms which might need instantiating.

The second is to instantiate a template Form which contains a subform control. Once the template Form is open, its subform control can be populated with the Form we wish to instantiate. As a Form in the subform control, that Form becomes an instance of the Form. I’ve gone up to ~50 Forms that way but none of them is open, they are instantiated.

That may also work for Reports, I don’t know, I’ve never tried it.

Chris.
 

Users who are viewing this thread

Top Bottom