Open Multiple Instances of same Form

M

Mcrawford

I'm creating a db that our Tech service department will use to log phone
calls. They are requesting that they be able to have multiple instances of
the data entry form open at once. Is this possible? If so, what do I need to
do to enable this?
 
J

Jeff Boyce

Why? As in "why do they think they need multiple copies of the same form
open simultaneously?" What business need are they trying to solve with this
"solution"?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

Mcrawford

Well...in my opinion they don't need it. But here is their explaination:

When retreiving voicemail (they may have 3 or 4 at a time) they want to be
able to quickly input caller name, phone, problem desc. They want to keep the
forms open until they call the person back, at which time they will fill in
the remaiing fields and close the form.

They currently use Lotus Notes and this is how they are using it. I
personally think they need to change their ways.

I created a search form in Access which they can use to query the calls and
then edit them. Is this what you would suggest or is there a way to have
forms open simultaneously?
 
J

Jeff Boyce

Pete offers a link to a way to manage multiple instances of a form.

My preference would be to make it terribly simple for them to find a
previous (?incomplete) log record, but only open one form at a time.

Personal preference... JOPO (just one person's opinion).

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

Mcrawford

Thanks Jeff. I tried Pete's suggestion and it's working.

We'll see if they like it or not.
 
P

Pete D.

Be warned, Jeff does have point hope you don't have problems. Just a
thought after seeing Jeff's note. You want to think about limiting the
number of instances for memory concerns as some users never close a form,
they open and open and open and then complain about the program or windows
being so slow, darn programmer. Pete D.
 
P

Pete D.

I was worried you were going to ask that question, not sure, get back to you
on that one. You have plenty to do for now.

-
Pete D.
 
J

Jeff Boyce

One approach would be to create a public variable, a "counter", add one each
time you opened a form, subtract one each time you closed one, and "check"
the count each time you tried to open one.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Dirk Goldgar

In
Jeff Boyce said:
One approach would be to create a public variable, a "counter", add
one each time you opened a form, subtract one each time you closed
one, and "check" the count each time you tried to open one.

If you're storing references to the form instances in a collection,
you've got a counter ready-made: the collection's Count property.
 
M

Mcrawford

Thanks Dirk and Jeff for your responses.

Although I understand what you're suggesting, I'm new to Access and I'm not
sure what code I need to use to accomplish this. Can you give me some
guidence?
 
P

Pete D.

Look at the Function CloseAllClients() within the code you have. You can
modify it to use in the Function OpenAClient to check count of windows and
prevent opening another window if lngKt > X with x being total windows you
want opened at one time.
 
M

Mcrawford

Thanks Pete. I actually found some code that Dirk submitted on another thread
a couple years ago that limits the instances. It's working great.

My next question is regarding the CloseAllClients function. Instead of
removing/closing all clients from the collection what code do I need to only
close /remove the current form from the collection?
 
P

Pete D.

You should be able to just use the normal X to close the one window.
But if the user closes an instance with the normal interface, we need to
remove that instance from our collection. That's done in the Close event of
form frmClient like this:
Private Sub Form_Close()...
 
M

Mcrawford

Pete, please be patient with me, but I don't understand.

I do understand why we would but it in Private Sub Form_Close(), but what
code do I put under it? Obviously, if I just copy code from
CloseAllClients(), its still going to close all clients. Since I'm new to
this, I'm not understanding what each of the lines is telling it to do and
what does lngKt and lngI stand for? Can you elaborate? And are the "1"'s
variables to turn something on/off or is it an actual value?

Here is the code I'm referring to:

Function CloseAllClients()
Dim lngKt As Long
Dim lngI As Long

lngKt = clnClient.Count
For lngI = 1 To lngKt
clnClient.Remove 1
Next
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top