DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Need to Attach the file in Email ;using Ms-Access

  1. #1
    Join Date
    Mar 2007
    Posts
    9

    Exclamation Need to Attach the file in Email using Ms-Access

    Hai.
    i need to send and Receive Email with Attachmen using Ms-Access.
    am done the Send Emial. But the attachment is still pending.
    Am using the following code for send email.


    Private Sub Command20_Click()

    Dim mess_body As String
    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)

    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    With MailOutLook
    .BodyFormat = olFormatRichText
    .To = Me.Email_Address

    If (Cc_Address.Value = Null) Then
    Else
    .CC = Me.Cc_Address
    End If


    If (Bcc_Address.Value = Null) Then
    Else
    .BCC = Me.Bcc_Address
    End If


    .Subject = Me.Mess_Subject
    .HTMLBody = Me.mess_text
    If Left(Me.Mail_Attachment_Path, 1) <> "<" Then
    .Attachments.Add (Me.Mail_Attachment_Path)
    End If
    .Send
    End With
    'MsgBox MailOutLook.Body
    Exit Sub
    email_error:
    MsgBox "An error was encountered." & vbCrLf & "The error message is: " & Err.Description

    Resume Error_out
    Error_out:
    End Sub


    But the attachment is working as, we enter the full path of the file in the text box. But i need the Browse button to browse the file and the selected file path was stored in a text box. This type of file attachment i need it.

    I know the Microsoft Common Dialog Control was do this. But i can't put the CommonDiaog Box in my Access form. Because the error occured, when i go to put the CommonDialog Box in my Access Form.

    The error message is:

    You don't have the license required to use this ActiveX control.

    You tried to open a form containing an OLE object or an ActiveX control or you tried to create an ActiveX control. To obtain the appropriate license, contact the company that provides the licensed OLE object or ActiveX control.


    Then i try to Register the many Control, like comcat.dll, comctl32.dll, comdlg32.dll, COMDLG32.OCX.

    The COMDLG32.OCX only was Registered Successfully. But i have the same problem.

    The error is:


    c:\windows\system32\comctl32.dll was loaded, but the DllRegisterServer entry point was not found.

    This file can not be registered.


    So, still i am stuck. Pls help me

    I don't know why this error could be occured. if anybody know, how to solve this error.

    One thing. In my system i don't have the VB. The ActiveX controls are specific VB only? not Ms-Access?

    If i need to install anyone ActiveX control in my system, where is the location(path) i go to install the new ActiveX control.

    If anybody know how to attach the file in Email using Ms-Access for the above status, Please let me know.


    Thanks
    Tamilvanan
    Last edited by ttamilvanan81; 04-04-2007 at 06:30 AM. Reason: Add extra detail

  2. #2
    Join Date
    Mar 2005
    Location
    Los Angeles, Calif. AKA: Gangsta Yoda™
    Posts
    455
    No need for all that code. Just use Access' built in email capabilities.
    My code wil create an email populated withthe specifics shown in the arguments. The last argument is "True" which tells Access to present the email GUI for user interaction like adding an attachment.

    1 line of c0d


    Code:
    Application.DoCmd.SendObject acSendNoObject, , acFormatTXT, "meow@example.com", , , "Spam", "This is the message text", True
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer code questions via PMs.
    Microsoft MVP 2006-2009
    Office Development FAQ (VBA, VB6, VB.NET, C#)
    Software Engineer MCP (VB6 & .NET)
    Reps & Rating PostsVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address List

Similar Threads

  1. How to Attach a file in VB
    By azhagiri in forum VB Classic
    Replies: 11
    Last Post: 01-24-2007, 03:43 AM
  2. Replies: 6
    Last Post: 06-24-2005, 01:49 AM
  3. help reg creating ms access file
    By vbcoder in forum VB Classic
    Replies: 9
    Last Post: 04-28-2005, 12:36 PM
  4. Replies: 4
    Last Post: 07-16-2002, 08:47 PM
  5. Replies: 0
    Last Post: 04-17-2000, 01:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center