Results 1 to 10 of 10
  1. #1
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276

    Help Me Email Backup Code

    I am using the following code to backup the tables on my "D" Drive
    I want to add a code by which it not only save backup on my drive but also send these files to my email address XYZ@gmail.com



    Dim CurrentDay As String
    Dim CurrentMonth As String
    Dim CurrentYear As String
    CurrentDay = Day(Now)
    CurrentMonth = Month(Now)
    CurrentYear = Year(Now)

    DoCmd.OutputTo acOutputTable, "Purchases", "ExcelWorkbook(*.xlsx)", "D:\Reports 2014\Purchase 2014 (" + CurrentDay + "-" + CurrentMonth + "-" + CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
    DoCmd.OutputTo acOutputTable, "Sales", "ExcelWorkbook(*.xlsx)", "D:\Reports 2014\Sale 2014 (" + CurrentDay + "-" + CurrentMonth + "-" + CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
    DoCmd.OutputTo acOutputTable, "Company", "ExcelWorkbook(*.xlsx)", "D:\Reports 2014\Company 2014 (" + CurrentDay + "-" + CurrentMonth + "-" + CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint


    Export_Data_Exit:
    Exit Sub



    Export_Data_Err:
    MsgBox Error$
    Resume Export_Data_Exit
    End Sub

  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
    Why are you backing up to Excel instead of just copying the Access db?

    Emailing from Access with attachment is common topic. Search forum or web. Here is one: https://www.accessforums.net/access/...ect-17713.html
    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
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    To answer WHY
    its because my employees send their transactions record from another small towns to me by email. As on Excel the file is small so its easy to send records.
    Also they have access to low speed internet connections.

    Also note the Access DB file size is 1.07 GB so its not at all possible to transfer data just by copying.

  4. #4
    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 would be the size after Compact & Repair and zipped? I have code that creates a Windows Compression zip folder, copies db into the zip and attaches the zip to an email.
    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.

  5. #5
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    The size after Compact & Repair and zipped is 1.04 GB

  6. #6
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    I have tried to create the following code but it only send one table in Excel Xls format
    where as I want it to send at least 3 tables ( Purchases, Sales, And Company) that I am unable to figure out how to do.



    Private Sub cmdmailsnd_Click()

    DoCmd.SendObject acSendTable, "Purchases", acFormatXLS, _
    "XYZ@gmail.com", , , "Purchase Data Table", False

    End Sub

  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
    Can't use SendObject. Did you review the link I referenced?
    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
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276

  9. #9
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    Jane Please understand the following, then you will know what exactly is my problem.

    I have collection & distribution points in rural areas, this DB I developed so all these guys (who hardly know how to use computer) just enter the numbers i.e Quantity and price as for the description of material it is a dropdown combo where they select it.

    that is why I want one button to send 3 tables in xls format where they don't even had to type the address, subject etc. just send

  10. #10
    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
    Doesn't change the information already provided.

    You can either have the code send 3 separate emails using SendObject method.

    Or send one email with 3 attachments using the Outlook object method. (Actually, it is possible to write all 3 tables to the same Excel file and then would be only one attachment.)
    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. Replies: 6
    Last Post: 03-26-2014, 10:04 AM
  2. Creating a backup email address
    By Paul H in forum General Chat
    Replies: 4
    Last Post: 10-07-2013, 08:57 AM
  3. Add picture to my email code
    By cbrsix in forum Programming
    Replies: 3
    Last Post: 09-25-2013, 08:26 AM
  4. Add email to this piece of code
    By MelonFuel in forum Reports
    Replies: 1
    Last Post: 07-04-2012, 01:34 PM
  5. smtp email code
    By alyon in forum Access
    Replies: 2
    Last Post: 05-15-2012, 07:42 AM

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