Newsgroup: it.comp.appl.access
Titolo: access97+Winfax10

Buon giorno,
Possiedo access97 e winfax 10
Devo inviare dei report di offerte via fax  ai miei clienti con winfax.
Vorrei che la cosa fosse automatica nel senso che confermando con un
pulsante di comando
access trasmettesse a winfax il report e i relativi dati : numfax-nome ecc.
dati che sono presenti nel report che creo.
So che è possibile, sulla guida in linea di winfax c'è
il codice di un esempio ma non riesco a farlo funzionare lo stesso
dicasi per l'esempio trovato sul sito comune ,forse perchè è stato fatto per
winfax7.
grazie per l'aiuto
Stefano

 wrote in message
jZyL5.61486$3K3.1...@news.infostrada.it...


 wrote in message
jZyL5.61486$3K3.1...@news.infostrada.it...

Ma winfax10=winfaxPro?
Se si ti garantisco che funziona, perchè l'ho fatto più volte.
Fammi sapere se ti serve il codice
Ciao, bobbit

 Se si ti garantisco che funziona, perchč l'ho fatto piů volte.


 wrote in message
z4dM5.521$fx4....@news.infostrada.it...

Option Compare Database
Option Explicit
Global intNumDoc As Integer
Global OradiInvio As Boolean
Public golApp As Outlook.Application
Public golNameSpace As Outlook.NameSpace
'******************** Code Start ************************
'This code was originally written by Dev Ashish.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code courtesy of
'Dev Ashish
Private Const SW_HIDE = 0
Private Const SW_SHOWNORMAL = 1
Private Const SW_NORMAL = 1
Private Const SW_SHOWMINIMIZED = 2
Private Const SW_SHOWMAXIMIZED = 3
Private Const SW_MAXIMIZE = 3
Private Const SW_SHOWNOACTIVATE = 4
Private Const SW_SHOW = 5
Private Const SW_MINIMIZE = 6
Private Const SW_SHOWMINNOACTIVE = 7
Private Const SW_SHOWNA = 8
Private Const SW_RESTORE = 9
Private Const SW_SHOWDEFAULT = 10
Private Const SW_MAX = 10
Private Declare Function apiFindWindow Lib "user32" Alias _
    "FindWindowA" (ByVal strClass As String, _
    ByVal lpWindow As String) As Long
Private Declare Function apiSendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hwnd As Long, ByVal Msg As Long, ByVal _
    wParam As Long, lParam As Long) As Long
Private Declare Function apiSetForegroundWindow Lib "user32" Alias _
    "SetForegroundWindow" (ByVal hwnd As Long) As Long
Private Declare Function apiShowWindow Lib "user32" Alias _
    "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function apiIsIconic Lib "user32" Alias _
    "IsIconic" (ByVal hwnd As Long) As Long
Global Listafile(10) As String
Global strInvoiceWhere ' Global for both MSFax and WinFax examples
Declare Function FindWindow& Lib "user32" Alias "FindWindowA" (ByVal
IpClassName As String, ByVal IpWindowName As String)    ' WinFax only
Function WinFaxInvoices()
    Dim dbsNorthwind As Database
    Dim rstCustomers As Recordset
    Dim intSendFaxReturnVal As Integer
    Set dbsNorthwind = CurrentDb()
    Set rstCustomers = dbsNorthwind.OpenRecordset("Customers",
dbOpenDynaset) ' Set Recordset to Customers table
    intSendFaxReturnVal = -1   ' Priming return value to True
    If MsgBox("Do you want to fax invoices" & Chr(13) & "to all customers
using WinFax?", 4) = 6 Then ' Make sure user wants to send fax to customers
        intSendFaxReturnVal = -1   ' Priming return value to True
        With rstCustomers
        Do Until .EOF Or intSendFaxReturnVal = 0 ' start do until end of
file or return value = false
            strInvoiceWhere = "[customerid] = '" & ![CustomerID] & "'" '
sets global strInvoiceWhere
            intSendFaxReturnVal = SendWinFax(![ContactName], ![Fax],
"rptWinFaxInvoice") 'Call user defined function and pass in data
            .MoveNext   ' Move to next record in Recordset
        Loop
        End With
    End If
End Function
Function SendWinFax(strFaxName As String, strFaxNumber As String,
strReportName As String) As Integer
    Dim lngChannelNumber As Long
    Dim strFaxStatus As String
    Dim FaxTime As String
    Dim strRecipFaxNum As String
    Dim strRecipTime As String
    Dim strRecipDate As String
    Dim strRecipName As String
    Dim strRecipient As String
    On Error GoTo SendWinFax_Error  'Error Trap
        strRecipFaxNum = Chr$(34) & strFaxNumber & Chr$(34)
        strRecipTime = Time()
        strRecipDate = Date
        strRecipName = Chr$(34) & Left$(strFaxName, 24) & Chr$(34)
        strRecipient = strRecipFaxNum & "," & strRecipTime & "," &
strRecipDate & "," & strRecipName
        lngChannelNumber = DDEInitiate("faxmng32", "CONTROL")   'Initiate
DDE connection
        strFaxStatus = DDERequest(lngChannelNumber, "STATUS")   'Get and set
status of DDE connection
        While strFaxStatus Like "Busy*"
            strFaxStatus = DDERequest(lngChannelNumber, "STATUS")
        Wend
        lngChannelNumber = DDEInitiate("FAXMNG", "TRANSMIT")    'set
ChannelNumber to current DDE Channel
        DDEPoke lngChannelNumber, "Sendfax", "recipient(" & strRecipient &
")"          'Poke recipient data
        DDEPoke lngChannelNumber, "Sendfax", "showsendscreen(""0"")"
'Poke to showscreen
        DoCmd.OpenReport strReportName, A_NORMAL
        SendWinFax = -1 ' setting return value to True
SendFax_Exit:
    DDETerminateAll             'Terminate all links.
    lngChannelNumber = False    'Set lngChannelNumber to false clears the
varible.
    Exit Function               'All Done
SendWinFax_Error:
    MsgBox "Error:" + Error$, 0, "SendFaxl"   'Print Error message and
number
    Resume SendFax_Exit
End Function
Ciao, Bobbit