Results 1 to 7 of 7
  1. #1
    Lounger
    Join Date
    Jul 2002
    Location
    Hampshire, Illinois, USA
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Fax with VBA / Outlook (Access/Outlook 2003)

    In the past this code worked fine - now I get an error message:

    The recipient's fax #'s appear in a temporary table named "testfax" ... the [FaxNumber] field already contains the "1" in the first position...
    The Code:

    Function FaxTEST()

    Dim MyDB As DAO.Database
    Dim rst As DAO.Recordset

    Set MyDB = CurrentDb()
    Set rst = MyDB.OpenRecordset("testfax", dbOpenDynaset)

    With rst
    Do Until .EOF
    DoCmd.SendObject acReport, "rptJobSiteMeeting", acFormatRTF, _
    "[fax:" & ![FaxNumber] & "]", , , , , False
    .MoveNext
    Loop
    End With

    rst.Close

    End Function

    If I manually type: [fax: 1##########] and send the message from Outlook directly, it goes out fine... (I replaced the actual numbers with the "#" - for privacy reasons...)


    Error: Your message did not reach some or all of the intended recipients.

    Subject:
    Sent: 10/15/2008 12:39 PM

    The following recipient(s) cannot be reached:

    '1##########' on 10/15/2008 12:39 PM

    The message could not be delivered because the recipient's destination email system is unknown or invalid. Please check the address and try again, or contact your system administrator to verify connectivity to the email system of the recipient.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Fax with VBA / Outlook (Access/Outlook 2003)

    What happens if you do the following?
    - Press Alt+F11 to activate the Visual Basic Editor.
    - Press Ctrl+G to activate the Immediate window.
    - Copy/paste the following line into the window:

    DoCmd.SendObject acReport, "Invoice", acFormatRTF, "[fax: 1234567890]", , , , , False

    - Substitute a valid fax number from your testfax table for 1234567890.
    - With the insertion point anywhere in the line, press Enter.

    Does the fax get sent?
    Do you get any security popup windows?

  3. #3
    Lounger
    Join Date
    Jul 2002
    Location
    Hampshire, Illinois, USA
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fax with VBA / Outlook (Access/Outlook 2003)

    Hey Hans! I tried to send it in the immediate window and it was again rejected with the same error. Is there an Outlook setting that maybe I'm missing? For example: Fax Mail Transport versus Exchange Server - settings??

    Eileen

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Fax with VBA / Outlook (Access/Outlook 2003)

    Strange - DoCmd.SendObject is supposed to be the direct equivalent of File | Send To. I'm afraid I have no explanation (and I cannot experiment with this myself, not having a fax modem).

    I hope that someone else will have a helpful suggestion.

  5. #5
    Lounger
    Join Date
    Jul 2002
    Location
    Hampshire, Illinois, USA
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fax with VBA / Outlook (Access/Outlook 2003)

    It is odd. I can from directly in Outlook enter [fax: 1xxxxxxxxxx] and hit send -- and off it goes without a problem. When I try to pass the string, which is formatted exactly the same in the SENT folder as the message I successfully send manually, it gets rejected. I think it must have something to do with my syntax or something. I have no explanation either. Thanks for your quick response. Always appreciated.

  6. #6
    Lounger
    Join Date
    Jul 2002
    Location
    Hampshire, Illinois, USA
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fax with VBA / Outlook (Access/Outlook 2003)

    I FOUND CODE THAT WORKS!!!! <img src=/S/bananas.gif border=0 alt=bananas width=33 height=35>

    Dim objOutlook As New Outlook.Application
    Dim objOutlookMsg As Outlook.MailItem
    Dim FaxNo As String, FaxTo As String, TheJob As String, TheDate As Date, TheTime As String, BidsDueDate As Date, BidsDueTime As String, FromCo As String
    Dim db As DAO.Database
    Dim maillist As DAO.Recordset

    Set db = CurrentDb()
    Set maillist = db.OpenRecordset("qryBidders")

    Do Until maillist.EOF

    FaxNo = "1" & maillist("FaxNumber")
    FromCo = maillist("CompanyName")
    FaxTo = maillist("Company") & " - " & maillist("ContactPerson")
    TheJob = maillist("TheBid")
    TheDate = maillist("JobSiteMeetingDate")
    TheTime = maillist("JobSiteMeetingTime")
    BidsDueDate = maillist("BidDueDate")
    BidsDueTime = maillist("BidDueTime")

    If FaxNo <> "1" Then

    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
    With objOutlookMsg
    .To = "[Fax:" & FaxNo & "]"
    .Subject = "INVITATION TO JOB SITE MEETING"
    .Body = "To: " & FaxTo & Chr(10) & "You are invited to attend a Job Site Meeting on: " & TheDate & " at: " & TheTime & Chr(10) & "From: " & FromCo & Chr(10) & "For Project Name: " & TheJob & Chr(10) & Chr(10) & "Bids are Due: " & BidsDueDate & " at: " & BidsDueTime & "."
    .Importance = olImportanceHigh
    '.Attachments.Add ("C:Test fax.doc")
    .Send
    End With

    End If
    maillist.MoveNext
    Loop

    Set objOutlookMsg = Nothing
    Set maillist = Nothing
    db.Close
    Set db = Nothing

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Fax with VBA / Outlook (Access/Outlook 2003)

    Great! Thanks for sharing, this could be useful to others.

Posting Permissions

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