Pass value from textbox to autodialer (1 Viewer)

C

Chami

Guest
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

Registered User.
Local time
Today, 22:36
Joined
Aug 7, 2000
Messages
2,639
I am not familiar with Autodialer but look at DoCmd.RunCommand acCmdAutodial
 

Fornatian

Dim Person
Local time
Today, 22:36
Joined
Sep 1, 2000
Messages
1,396
I use this function:
Code:
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:

Code:
fAutoDial "telephonefield"

HTH

Ian
 

Users who are viewing this thread

Top Bottom