Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    San Francisco, CA, USA
    Thanked 0 Times in 0 Posts

    Outlook/Access Fax

    I'm trying to export from Access 2000 to MS Outlook 98 items to fax broadcast. I can get access to export email addresses to the outbox in outlook but not fax messages. I keep getting a message that I'm using the wrong format for the fax address. I tried copy what Microsoft fax puts in
    the message and have tried duplicating this but to no avail.
    Any help would be appreciated. Thanks Frank
    Option Compare Database ' Use database order for string comparisons.
    Option Explicit ' Requires variables to be declared before they are used.

    Private Sub cmdCreateInternetMail_Click()

    ' Make sure you have the Outlook library referenced.

    ' Outlook - Create Internet Mail To A Group Of People"

    ' The purpose of this example is to show how to create
    ' an Internet Message to employees in Northwind. Email
    ' can be sent to ALL employees of Northwind or the
    ' employees selected by a query.

    ' There is also a form in the database to add your own
    ' email messages and create your own queries so that
    ' you can use this database to send email to groups of
    ' people.

    Dim objOutlook As Object
    Dim DB As Database
    Dim RS As Recordset
    Dim MailItem As Object
    Dim Attach As String

    ' If no item is chosen from the combo box, the user is
    ' given a message.
    If IsNull(Me!cboMailType) Then
    MsgBox "Enter a Mail Type"
    Exit Sub
    End If

    DoCmd.Hourglass True

    ' Use DAO to create a recordset.
    Set DB = DBEngine(0)(0)
    Set RS = DB.OpenRecordset(Me![cboMailType].Column(1), dbOpenSnapshot)

    ' If there is no records returned by the query, give the user
    ' a message box.
    If RS.BOF And RS.EOF Then
    MsgBox "There are no records returned by the query"
    Exit Sub
    End If

    ' Move to the first Employee record

    ' Resume to the next line following the error. This is
    ' necessary because with "GetObject" if Outlook is NOT
    ' open, an error will occur.
    On Error Resume Next

    ' Use GetObject if an application is already running, if not,
    ' use CreateObject. Error 429 occurs with GetObject if Outlook
    ' is not running.
    Set objOutlook = GetObject(, "Outlook.Application")

    ' Error 429 occurs if Outlook is NOT running.
    If Err.Number = 429 Then
    Err.Number = 0
    ' Create a new instance of the Outlook application.
    Set objOutlook = CreateObject("Outlook.Application")
    ' Error 429 will occur if MS Outlook 8.0 is not installed.
    If Err.Number = 429 Then
    MsgBox "MS Outlook 8.0 is not installed on your computer"
    End If
    End If

    ' Loop through all of the records returned by the query.
    Do Until RS.EOF

    ' Create a new Outlook Mail Item.
    Set MailItem = objOutlook.CreateItem(olMailItem)

    ' Insert data into the Outlook mail item.
    With MailItem

    ' In the "To" field, add the email address
    '.To = RS!BusinessFax
    .To = RS!InternetEMail

    ' Add the subject to the Subject field from the
    ' second column of the cboMailType combo box.
    .Subject = Me![cboMailType].Column(2)

    ' Add the body to the body field from the
    ' third column of the combo box. Add a
    ' couple of line feeds so that if a document
    ' is attached, it is after the body of the
    ' message.
    .Body = Me![cboMailType].Column(3) & vbCrLf & vbCrLf

    ' Add the attachment to the mail item.
    .Attachments.Add Me![cboMailType].Column(4)

    ' Set the mail items importance to "High"
    .Importance = olImportanceHigh

    ' The "Send" method will put the mail items
    ' in the Outbox. To actually send the email
    ' the user needs to choose "Check for New
    ' Mail" from the Tools menu or hit the F5 key.

    End With

    ' Move to the next Employee Record


    ' Inform the user that all email messages have been generated.
    MsgBox RS.RecordCount & " messages have been sent."


    Set RS = Nothing

    ' Release the object variable.
    Set objOutlook = Nothing


    DoCmd.Hourglass False

    End Sub

    Private Sub cmdReadme_Click()

    DoCmd.OpenForm "frmReadMe"

    End Sub

    Sub ExitMicrosoftAccess_Click()

    ' Exit Microsoft Access.

    End Sub
    Sub DisplayDatabaseWindow_Click()

    ' Close Automation Examples form.

    ' Give focus to Database window; select Employees table (first
    ' form in list).
    DoCmd.SelectObject acTable, "Employees", True

    End Sub

    Private Sub Form_Open(Cancel As Integer)

    SendKeys "{F4}"

    End Sub

  2. #2
    Platinum Lounger
    Join Date
    Jan 2001
    Roanoke area, Virginia, USA
    Thanked 0 Times in 0 Posts

    Re: Outlook/Access Fax

    what fax number format are you using? check to be sure, but i think you need to use something like [fax@17045551212] brackets and all.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    San Francisco, CA, USA
    Thanked 0 Times in 0 Posts

    Re: Outlook/Access Fax

    Hi Mary,
    Thanks for responding to my question.
    Seems to work now. The code is you add the guy to the contacts and his fax number then the format is FirstNameLastName (Business Fax)
    Does not seem to work with the [Fax@1234234]
    Well if you look at the code I posted I put a field named OLE on the access form with a Word Doc inserted into it. I made MS Word as my Email Editor. I want to be able to insert the Word doc in the Outlook Body of the mailItem but can't get it to work. What I want to do really is do a contact management thing in Access. Then pick a doc and have it go over to Outlook and do a fax broadcast. I would flip through my contacts files put in or select a doc and send that over to Outlook and then when I have about a hundred contacts there I fax broadcast. The problem I don't like is have to have To as the Name (Business Fax)and so forth. I just want to fax any doc and only that but using Access as my contact and filing database.
    Can you help?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts