Keeping track of calls made by the AutoDial

mhubbard

Registered User.
Local time
Today, 08:43
Joined
Jul 31, 2002
Messages
25
I have an Auto Dial button on a form and when pushed the Auto dialer pops up and a person can enter the number. Behind the scenes I am keeping track of the number of Phone calls a person makes. The draw back is regardless if they hit OK or Cancel on the Auto Dialer, It is adding another count to the Activities Table. I just want a record added if they hit OK, not cancel
Is this possible?
Thanks for your help!


Below is the code
Private Sub Command65_Click()
Dim rsLog As Recordset
On Error GoTo Err_Command65_Click
Dim intstart As Integer
Dim stDialStr As String
Dim PrevCtl As Control

Const ERR_OBJNOTEXIST = 2467
Const ERR_OBJNOTSET = 91

PhoneWork.SetFocus
Set PrevCtl = PhoneWork


If TypeOf PrevCtl Is TextBox Then
stDialStr = IIf(VarType(PrevCtl) > V_NULL, PrevCtl, "")
ElseIf TypeOf PrevCtl Is ListBox Then
stDialStr = IIf(VarType(PrevCtl) > V_NULL, PrevCtl, "")
ElseIf TypeOf PrevCtl Is ComboBox Then
stDialStr = IIf(VarType(PrevCtl) > V_NULL, PrevCtl, "")
Else
stDialStr = ""
End If



Application.Run "utility.wlib_AutoDial", stDialStr


Me.Notes.Form.Notepad = Now() & "--" & " " & GetCurrentUserName() & " " & "--" & "Phone Call" & vbCr & vbLf & Me.Notes.Form.Notepad
intstart = Len(Me.Notes.Form.Notepad)

Set rsLog = CurrentDb.OpenRecordset("dbo_TSActivities")
With rsLog
.AddNew
![Personid] = Personid
![Typeofcontact] = "Phone"
![Userid] = GetCurrentUserName()
![datestamp] = Date

.Update
End With

Exit_Command65_Click:
Exit Sub

Err_Command65_Click:
If (Err = ERR_OBJNOTEXIST) Or (Err = ERR_OBJNOTSET) Then
Resume Next
End If
MsgBox Err.Description
Resume Exit_Command65_Click

End Sub
 

Users who are viewing this thread

Back
Top Bottom