Cenfus wrote:
Quote:
Originally Posted by
(Access 2000, that is).
>
I have a table with phone numbers in it.
How do I have an Access form or macro pick up a single number that's
displayed in a form and pass it to the dialler ("C:\Program
Files\Windows NT\dialer.exe") ?
>
Really grateful if anyone can point me in the right direction. It
would really speed up use of my address book.
>
Many thanks in advance, from Clifton in Bristol.
>
If you open up a form in Design mode, click on the toolbox and select
the command button. When the wizard comes up, select Miscellaneous,
then AutoDialer. It will write out the code for you but it expects the
previous control to be the phone number. If you can code, you can
modify it to work otherwise Here's the code generated by the wizard.
Private Sub Command7_Click()
On Error GoTo Err_Command7_Click
Dim stDialStr As String
Dim PrevCtl As Control
Const ERR_OBJNOTEXIST = 2467
Const ERR_OBJNOTSET = 91
Set PrevCtl = Screen.PreviousControl
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_Command7_Click:
Exit Sub
Err_Command7_Click:
If (Err = ERR_OBJNOTEXIST) Or (Err = ERR_OBJNOTSET) Then
Resume Next
End If
MsgBox Err.Description
Resume Exit_Command7_Click
End Sub
You could change it to
Private Sub Command7_Click()
On Error GoTo Err_Command7_Click
'assumes the form's textbox name is PhoneNumber
Application.Run "utility.wlib_AutoDial", Me.PhoneNumber
Exit_Command7_Click:
Exit Sub
Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click
End Sub