G
Gino
The automaion feature:
Like big companies do, when a phone call rings at the office, my Access
Database automatically opens a form displaying the caller information as
captured by the modem with caller ID (and searches the database to display
the customer record, if he is already in it).
If two or more calls come in while the user is not at his computer,
additional instances of the same form will open, with each form displaying
the info for each different caller.
I have been able to program Access to respond in the manner described above
by using some code I found on this forum plus the caller ID routine that came
with the Tapi ActiveX I am using.
The problem:
The problem I have is that whenever a phone call comes in, two instances of
the form get opened almost simultaneously instead of one.
If I put a break in the code and then proceed line by line with F8, then at
the end of the code, I find just one form (the code is written to generate
only one new instance of the form at each phone call). It almost looks as
if the computer runs too fast and generates a second form instance before the
next line of code is run...
Could it be due to the response of the Tapi ActiveX?
If so could I prevent it with some kind of timing loop?
Any suggestions?
Thank you very much!
_________________________________________________
Code to generate and manage multiple Form instances is here below.
Credit for code: 'Author: Allen J Browne, July 2004
_________________________________________________
Option Explicit
Public clnClient As New Collection 'Instances of frmClient.
Function OpenAClient()
'----Purpose: Open an independent instance of form frmCaller whenever a
new phone call comes in.
Dim frm As Form
'----Open a new instance, show it, and set a caption.
Set frm = New Form_frmCaller
frm.Visible = True
frm.Caption = frm.Hwnd & ", opened " & Format(Now(), "short time")
'----Append it to our collection.
clnClient.Add Item:=frm, Key:=CStr(frm.Hwnd)
'Set frm = Nothing
'--- Offset Position of new form on the screen (because new instance exactly
overlaps previous form
Dim lngKt As Long
Dim lngI As Long
Dim vrbPosition As Integer
lngKt = clnClient.Count
For lngI = 1 To lngKt
Next
vrbPosition = lngI * 500
frm.Move vrbPosition, vrbPosition
lngI = 1
Set frm = Nothing
End Function
_________________________________________________
Like big companies do, when a phone call rings at the office, my Access
Database automatically opens a form displaying the caller information as
captured by the modem with caller ID (and searches the database to display
the customer record, if he is already in it).
If two or more calls come in while the user is not at his computer,
additional instances of the same form will open, with each form displaying
the info for each different caller.
I have been able to program Access to respond in the manner described above
by using some code I found on this forum plus the caller ID routine that came
with the Tapi ActiveX I am using.
The problem:
The problem I have is that whenever a phone call comes in, two instances of
the form get opened almost simultaneously instead of one.
If I put a break in the code and then proceed line by line with F8, then at
the end of the code, I find just one form (the code is written to generate
only one new instance of the form at each phone call). It almost looks as
if the computer runs too fast and generates a second form instance before the
next line of code is run...
Could it be due to the response of the Tapi ActiveX?
If so could I prevent it with some kind of timing loop?
Any suggestions?
Thank you very much!
_________________________________________________
Code to generate and manage multiple Form instances is here below.
Credit for code: 'Author: Allen J Browne, July 2004
_________________________________________________
Option Explicit
Public clnClient As New Collection 'Instances of frmClient.
Function OpenAClient()
'----Purpose: Open an independent instance of form frmCaller whenever a
new phone call comes in.
Dim frm As Form
'----Open a new instance, show it, and set a caption.
Set frm = New Form_frmCaller
frm.Visible = True
frm.Caption = frm.Hwnd & ", opened " & Format(Now(), "short time")
'----Append it to our collection.
clnClient.Add Item:=frm, Key:=CStr(frm.Hwnd)
'Set frm = Nothing
'--- Offset Position of new form on the screen (because new instance exactly
overlaps previous form
Dim lngKt As Long
Dim lngI As Long
Dim vrbPosition As Integer
lngKt = clnClient.Count
For lngI = 1 To lngKt
Next
vrbPosition = lngI * 500
frm.Move vrbPosition, vrbPosition
lngI = 1
Set frm = Nothing
End Function
_________________________________________________