By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 1,944 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

Emailing the Actual Database

P: 1
Hi everyone,

I know there's the ability to email the reports from an access database, but I was wondering if it was possible to create a button that would email the actual database. I've done some research on this and haven't come up with anything so I'm not so sure about it being possible or not.

Thanks in advance to any help you can provide,
Lozzo
May 14 '07 #1
Share this Question
Share on Google+
2 Replies


ADezii
Expert 5K+
P: 8,619
Hi everyone,

I know there's the ability to email the reports from an access database, but I was wondering if it was possible to create a button that would email the actual database. I've done some research on this and haven't come up with anything so I'm not so sure about it being possible or not.

Thanks in advance to any help you can provide,
Lozzo
To the best of my knowledge, you cannot E-Mail the actual Database itself via the SendObject() Method. Your best best would be to Zip the Database, (should get a high Compression Ratio), then send it as a File Attachment.
May 17 '07 #2

MSeda
Expert 100+
P: 159
these are some macros I use to zip and send a backend data base from a command button in the FE.

Expand|Select|Wrap|Line Numbers
  1.   Sub ZipnSendUpdate(myPath As String, mySource As String, myName As String)
  2.  
  3.       Dim FileNameZip, FolderName
  4.  
  5.       Dim strDate As String, DefPath As String
  6.  
  7.       Dim oApp As Object
  8.  
  9.       Dim appOutLook As Outlook.Application
  10.  
  11.       Dim MailOutLook As Outlook.MailItem
  12.  
  13.       Dim myRecip As String
  14.  
  15.  
  16.  
  17.       DefPath = myPath
  18.  
  19.       If Right(DefPath, 1) <> "\" Then
  20.  
  21.           DefPath = DefPath & "\"
  22.  
  23.       End If
  24.  
  25.  
  26.  
  27.       FolderName = mySource
  28.  
  29.       strDate = Format(Now, "mmddyy")
  30.  
  31.       FileNameZip = DefPath & myName & strDate & ".zip"
  32.  
  33.  
  34.  
  35.       'Create empty Zip File
  36.  
  37.       NewZip (FileNameZip)
  38.  
  39.  
  40.  
  41.       Set oApp = CreateObject("Shell.Application")
  42.  
  43.  
  44.  
  45.       'Copy the files to the compressed folder
  46.  
  47.       oApp.NameSpace(FileNameZip).copyhere oApp.NameSpace(FolderName).Items
  48.  
  49.  
  50.  
  51.  
  52.  
  53.           Do Until oApp.NameSpace(FileNameZip).Items.Count = oApp.NameSpace(FolderName).Items.Count
  54.  
  55.           DoEvents
  56.  
  57.           Loop
  58.  
  59.  
  60.  
  61.           Set oApp = Nothing
  62.  
  63.  
  64.  
  65.   Set appOutLook = CreateObject("outlook.Application", "localhost")
  66.  
  67.   Set MailOutLook = appOutLook.CreateItem(olMailItem)
  68.  
  69.  
  70.  
  71.   myRecip = ELookup("[Employee Email]", "[Employee Table]", "[Receive Data Update] = YES AND [Employee Location] <> '" & myLoc & "'")
  72.  
  73.  
  74.  
  75.   With MailOutLook
  76.  
  77.   .Subject = Format(Now, "mm/dd/yy") & " Data Update"
  78.  
  79.   .body = "Attached please find the daily data update"
  80.  
  81.   .To = myRecip
  82.  
  83.   .Attachments.Add FileNameZip
  84.  
  85.   .Send
  86.  
  87.   End With
  88.  
  89.  
  90.  
  91.   End Sub
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.   Sub NewZip(sPath)
  100.  
  101.   'Changed by keepITcool Dec-12-2005
  102.  
  103.  
  104.  
  105.       If Len(Dir(sPath)) > 0 Then Kill sPath
  106.  
  107.       'Create empty Zip File
  108.  
  109.       Open sPath For Output As #1
  110.  
  111.       Print #1, Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String(18, 0)
  112.  
  113.       Close #1
  114.  
  115.  
  116.  
  117.   End Sub
  118.  
  119.  
newzip is something I actually found on excel site, it is pretty generic and should work as is. ZipnSend is tailored to my application so you'll need to tweek it to use in your app.
May 17 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.