Another issue in the incident tracking database I'm trying to set up:
scenario: multiple incidents going on at the same time -- some are
taken care of quickly and others take much longer, such that the one
that is started first might be done before one that starts later.
Meanwhile, the dispatcher is entering data about each incident as it
becomes available.
But this means that the dispatcher (who is both monitoring the
incident AND entering data in "real time") needs to have multiple
forms available at the same time. And have them available until each
particular incident is closed out (completed/cleared). I'd like to
have data entry occur in a FORM, rather than in a datasheet
(spreadsheet-like) format, since I think it's easier for the
dispatcher to see what's happening in each given incident that way.
But, I haven't found a way to open a new form on-screen while another
form is still visible. Is this possible? Is there some way to launch
another form while keeping the previous one on-screen and visible. And
have it that data can be entered into any of the forms.
My design of the system hinges on this capability. If it's NOT
possible to do this, then I need to know ASAP, since I then would have
to totally redesign the logic being used. Please help ASAP!
TIA.
--VIC (vmk...@hotmail.com) <--- direct EM's gratefully acceptable!!
First, I think you'll need a collection to hold the forms (at least if
you want to refer to them from elsewhere):
Public colIncidentForms as Collection
which must be initialised somewhere
Set colIncidentForms = New Collection
Then the "CreateIncident" code would contain something like this:
Dim frmI as New Form_IncidentForm
With frmI
.txtCreated.Value = Now()
.Caption = strIncidentName
'other stuff to get the form behaving as you want
.visible = true
End With
colIncidentForms.Add frmI
Set frmI = Nothing
which creates a new instance of the form and adds it to the
collection.
You'll also need code (in the Close event of the form?) to remove
forms from the collection as they're closed.
On Sat, 11 Nov 2000 12:56:11 -0500, "Vic Kamhi" <vmk...@hotmail.com>
wrote:
--
John
Please reply to the newsgroup and not by e-mail. That way, more
brain cells get to work on the problem!
Here are a few lines of code that you will need in the declaration part
(top) of your module:
Const MaxWindows As Integer = 9 'Gives a maximum of 10 windows, 0 is the
first one
Public PersonWindow(MaxWindows) As Form_Personer
Dim PersonWindowAssigned(maxWindows) As Boolean 'Elements in array are
initialized to FALSE by default
'The function opens a new window for the personID (PID) that is part of the
call
Public Function OpenFamilyPerson(PID As Variant) As Boolean
Dim Ctr As Integer
Dim WindowAssigned As Boolean
Dim strNewRecord As String
'Prepare a Select statment for the data to be populated into the form.In
this example the data comes from
'a table Personer
strNewRecord = "SELECT * FROM Personer WHERE PersonID = " & PID
'The loop belows goes through all instances of form and checks for a free
one.
'When a free form is found it enters data by updateing the RecordSource
Property
'It also updates the PersonWindowAssigned array which keeps track of
free/assigned windows
WindowAssigned = False
For Ctr = 0 To MaxWindows Step 1
If Not PersonWindowAssigned(Ctr) Then
Set PersonWindow(Ctr) = New Form_Personer
PersonWindow(Ctr).RecordSource = strNewRecord
PersonWindow(Ctr).Visible = True
PersonWindow(Ctr).WindowNo = Ctr
'WindowNo is the name of an unbound control in form_personer
PersonWindowAssigned(Ctr) = True
WindowAssigned = True
Exit For
End If
Next Ctr
If WindowAssigned Then
OpenFamilyPerson = True
Else
OpenFamilyPerson = False
MsgBox "Too many Windows opened, max number is " & MaxWindows + 1
End If
End Function
"Vic Kamhi" <vmk...@hotmail.com> wrote in message
news:0LfP5.49360$KI6.10...@typhoon.snet.net...
here are a few lines of code that you will need in the declaration part
(top) of your module:
Const MaxWindows As Integer = 9 'Gives a maximum of 10 windows, 0 is the
first one
Public PersonWindow(MaxWindows) As Form_Personer
Dim PersonWindowAssigned(maxWindows) As Boolean 'Elements in array are
initialized to FALSE by default
'The function opens a new window for the personID (PID) that is part of the
call
Public Function OpenFamilyPerson(PID As Variant) As Boolean
Dim Ctr As Integer
Dim WindowAssigned As Boolean
Dim strNewRecord As String
strNewRecord = "SELECT * FROM Personer WHERE PersonID = " & PID
'The loop below looks for the first free window,updates the recordsource and
exits