Results 1 to 11 of 11
  1. #1
    mchung is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2013
    Location
    US
    Posts
    5

    Email can send when convert accdb to mdb file in access 2007


    Hi,

    I am new to this site and hope someone can help me. I have a data entry form developed in access 2007. Once the form is filled and hit the send button, this will send out the email to the admin. Everything works fine at this point, however, when I converted to .mdb file, the send button doesn't work and I can't get to design view in .mdb file (it wont allow me). Is there something I am not doing it correctly?

    Thanks and appreciate anyone can help me on this.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    What message do you get when it "won't allow" you to open object in design view?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mchung is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2013
    Location
    US
    Posts
    5
    No error message appear when I hit the send button in .mdb file. Just won't do anything. Here is my code.

    Private Sub CmdEmail_Click()
    'Start of code
    Dim strEmail, strBody As Variant
    Dim objOutlook As Object
    Dim objEmail As Object
    Dim stTopicName As Variant
    Dim stReqName As Variant
    Dim stReqReason As Variant
    'If txtTopicName.Value = "" Then
    'MsgBox "Please enter a value"
    'End If
    'Creates an instance of Outlook
    Set objOutlook = CreateObject("Outlook.Application")
    DoEvents
    Set objEmail = objOutlook.CreateItem(olMailItem)
    DoEvents
    'Creates string with email address
    strEmail = "aa@abc.com"
    stTopicName = Me.txtTopicName
    stReqName = Me.txtReqName
    stReqEmail = Me.txtReqEmail
    stReqReason = Me.txtReqReason
    stText = "SME admin has received a new SME topic request." & Chr$(13) & _
    Chr$(13) & "New SME Topic: " & stTopicName & Chr$(13) & _
    "Requestor Name: " & stReqName & _
    Chr$(13) & "Requestor Email: " & stReqEmail & _
    Chr$(13) & "Reason for Requesting: " & stReqReason & Chr$(13) & _
    Chr$(13) & "SME admin will process the new request and respond within 14 business days."

    DoEvents
    'Creates and sends email
    With objEmail
    DoEvents
    .To = strEmail
    DoEvents
    .cc = stReqEmail
    DoEvents
    .Subject = "ACTION: NEW SME TOPIC REQUEST"
    DoEvents
    .Body = stText

    DoEvents
    DoEvents
    .Send
    End With
    DoCmd.Close
    DoCmd.OpenForm "frmNewRequestConfirmPage"
    Set objEmail = Nothing
    'Closes Outlook. Remove if you do not want to close Outlook
    objOutlook.Quit
    Exit Sub
    End Sub

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Why can't you get into design view of your .mdb?

  5. #5
    mchung is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2013
    Location
    US
    Posts
    5
    There was no option to open in design view. I right click on the form, only form view is allowed and same as the view in the ribbon. It was set like this after I converted the accdb file to mdb file. Maybe this has to do with front end accdb file convert to mdb?

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Have you tried pressing and holding the shift key down before and during the process of opening the file?

    June7 asked about this to help determine where there may or may not be a problem

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You are using late binding in the code so I guess a VBA reference to Outlook should not be an issue. I didn't worked with 2003 very long, never tried email code with it.

    Don't understand need for so many Do Events. I have none anywhere in my entire codeset, not even email procedure.

    Then the next question is why do you need mdb version?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    mchung is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2013
    Location
    US
    Posts
    5
    I just tried that, and still the same.

  9. #9
    mchung is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2013
    Location
    US
    Posts
    5
    are you saying.. should I just have one Do Events. I just tried that, but still doesn't work. Again, it works in .accdb file, but not .mdb file.

    DoEvents
    'Creates and sends email
    With objEmail

    .To = strEmail
    .cc = stReqEmail
    .Subject = "ACTION: NEW SME TOPIC REQUEST"
    .Body = stText
    .Send
    End With

  10. #10
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Looking at the code, nothing is really jumping out at me. Here is a code snippit I use. You can add your stReqEmail
    to the olMailItem object with .cc. There is not a .cc in the example.

    I am not convinced focussing on the code is crucial at the moment. Seems like other questions should be addressed.


    Code:
     
    Dim bolSend As Boolean 'Toggle to ask user if they want to view Email before sending
    Dim objOutlookRecip As Outlook.Recipient
    Dim objOutlookAttach As Outlook.Attachment
    Dim objOutlook As Outlook.Application
    Dim objOutlookMsg As Outlook.MailItem
    Dim strRecip As String  'Email address of recipient
    Dim strBody As String   'Text to compose the body of the email
    Dim strSubject As String 'Text to compose the subject line of the email
    Dim strPath As String 'Path to file to be used as attachment. Include file extension in full path
    bolSend = False 'If true then user will send email without user first reviewing email
    strRecip = ""
    strBody = ""
    strSubject = ""
    
    ' Create the Outlook session.
    Set objOutlook = CreateObject("Outlook.Application")
    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
    ' Add the To recipient(s) to the message.
    If Not IsNull(Me.ContEmailAddress.Value) Then
    strRecip = Me.ContEmailAddress.Value
    objOutlookMsg.To = strRecip
    End If
    ' Set the Subject, Body, and Importance of the message.
    objOutlookMsg.Subject = strSubject
    objOutlookMsg.Body = strBody
    objOutlookMsg.Importance = olImportanceNormal  'Normal importance
    ' Add attachments to the message.
    Set objOutlookAttach = objOutlookMsg.Attachments.Add(strPath)
        If bolSend = False Then 'Previous code sets variable according to user input
        objOutlookMsg.Display
        Else
        
            If strRecip = "" Then
                
                MsgBox "There is not an email address associated with this client. Aborted."
                GoTo Exit_Now
            Else
                objOutlookMsg.Save
                objOutlookMsg.Send
            
            End If
        
        End If
    Exit_Now:
    Set objOutlook = Nothing
    MsgBox "Email aborted"
    Exit Sub

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I agree, code does not seem to be the issue. I just thought all those Do Events were odd regardless (clutter). If you want to provide db, perhaps someone with 2003 can analyse. I no longer have 2003 available.

    Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Accdb To Accde Transfer, Access 2007
    By Luu in forum Access
    Replies: 3
    Last Post: 01-19-2013, 12:30 AM
  2. How to convert from .accdb to executablle files
    By cheesewizz in forum Access
    Replies: 1
    Last Post: 08-29-2012, 06:48 PM
  3. How can I send an email from access???
    By Asma in forum Programming
    Replies: 2
    Last Post: 12-07-2011, 07:49 AM
  4. VBA to Send email from Access
    By ped in forum Access
    Replies: 3
    Last Post: 08-11-2011, 05:37 PM
  5. Replies: 5
    Last Post: 10-24-2009, 01:16 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
  •  
Other Forums: Microsoft Office Forums