473,320 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Export Acces form records to email message..

Hi everyone i have a question and really hope someone can help me out:

In acces i have made a form with several records, the information in those records are send out to the body of a email message in Outlook i did that by a VBA code so if a users presses on that button it will do the job, but the problem is that it only picks the data of the current record and not all records of the form.


Is there a way to do this?

The code that i currently using is below:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Send_Mail_Click() 
  2.  
  3.     Set fso = CreateObject("Scripting.FileSystemObject") 
  4.     Set olObj = GetObject(, "Outlook.Application") 
  5.     Set olmail = olObj.createitem(olMailItem) 
  6.  
  7.  
  8.  
  9.  
  10.     olmail.Subject = "Training" 
  11.     olmail.Importance = "2" 
  12.     olmail.To = "" 
  13.     olmail.cc = "" 
  14.     olmail.bcc = "" 
  15.     olmail.htmlbody = "<p> Hello, here are the dates</p> " & vbNewLine & vbNewLine & "Title:" & " " & [Title] & vbNewLine & "Location:" & " " & [Location] & vbNewLine & "Start Time:" & " " & [Start Time] & vbNewLine & "End Time:" & " " & [End Time] & vbNewLine & vbNewLine & "Description:" & " " & [Description] & vbNewLine 
  16.     Email_Subject = "Training dates" 
  17.     olmail.display 
  18.  
  19.  
  20.  
  21.     On Error Goto debugs 
  22.     Set Mail_Object = CreateObject("Outlook.Application") 
  23.     Set Mail_Single = Mail_Object.createitem(0) 
  24.     With Mail_Single 
  25.         .Subject = Email_Subject 
  26.         .To = Email_Send_To 
  27.         .cc = Email_Cc 
  28.         .bcc = Email_Bcc 
  29.         .Body = Email_Body 
  30.  
  31.         .send 
  32.     End With 
  33. debugs: 
  34.     If Err.Description <> "" Then MsgBox Err.Description 
  35.  
  36.  
  37.  
  38. End If 
  39.  
  40.  
Apr 3 '14 #1
0 896

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

Similar topics

4
by: David Ehmer | last post by:
Does anyone know of a form to email ASP script that allows the user to attach an image file from their computer to be sent as an attachment to the email, along with other data collected from the...
16
by: David Lauberts | last post by:
Hi Wonder if someone has some words of wisdom. I have a access 2002 form that contains 2 graph objects that overlay each other and would like to export them as a JPEG to use in a presentation....
7
by: RC | last post by:
When I am adding records to a database and each record is unique by the Serial Number. I would like to step through my code adding records unless the Serial Number already exists in the database. ...
3
by: Zman | last post by:
I've recently added form functionality on my website, which runs with the aid of a perl script and sends the results via an email message. I'm currently able to import, or link, data from a...
1
by: Ken | last post by:
I have a form that has a command button on it to open a report. The report is based on the forms data, if it's filtered the report is filtered, if the form is showing 100 records the report is...
2
by: phillipmcgough | last post by:
I need to know how I can have a form sent to an email that is in a URL. For example: If I have a site with a form that has First Name: Last Name: Email: Phone: in it, and a person goes to...
3
by: jerertan | last post by:
hi guys, i have a problem over here..... wherenever i click the submit button to send the form to email using frontpage. it will show this error FrontPage Run-Time Component Page You have...
4
by: zufie | last post by:
I have a main form containing a command SEND button that prompts an email form to pop up. The email address(es) that are supposed to appear on the email form are those corresponding to the...
1
by: metalforever | last post by:
How do you redirect a form after submit(form sends email) ? This is pretty urgent for me. I have included the code in a pastebin. http://pastebin.org/249014 process_form sends the email. ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.