View Full Version : Pass value from textbox to autodialer


Chami
02-02-2002, 03:54 PM
I would like to use a command button to launch the autodialer and automatically enter the phone number from a particular text box. Any ideas? Thanx1

Jack Cowley
02-02-2002, 05:21 PM
I am not familiar with Autodialer but look at DoCmd.RunCommand acCmdAutodial

Fornatian
02-03-2002, 05:54 AM
I use this function:


Public Function fAutoDial(strPhoneNo As String)
On Error GoTo Err_fAutoDial
Dim stDialStr As String
Dim PrevCtl As Control
Const ERR_OBJNOTEXIST = 2467
Const ERR_OBJNOTSET = 91
Set PrevCtl = CodeContextObject(strPhoneNo)
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
Exit_fAutoDial:
Exit Function
Err_fAutoDial:
If (Err = ERR_OBJNOTEXIST) Or (Err = ERR_OBJNOTSET) Then
DispMsg "Autodial facilities have not been installed correctly on this machine."
Resume Next
End If
fMsgErr
Resume Exit_fAutoDial
End Function


then call it like:


fAutoDial "telephonefield"


HTH

Ian