473,379 Members | 1,216 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,379 software developers and data experts.

Auto email

I am in the process of developing an Ideas management database for the company which I work for.

I require an email facility driven by a Submit button from a form on Access, my problem is the email needs to be directed to the departmental manager selected on the form.

Managers details are stored in a table called Departments with following fields
Department - Manager - Email

Also a copy of the email needs to be sent to myself (Scheme Administrator)

I have made several attempts at trying to achieve the above but have been unsuccessful.

I look forward to hearing a solution

Many thanks

John
Oct 9 '08 #1
1 1281
I'm not entirely sure this is what you mean, but this works for me.
Replace 'you@youremail.com' with your email address, if you want to BCC instead of CC it, then move it to the next space (between the next , ,)

Expand|Select|Wrap|Line Numbers
  1. Private Sub SubmitButton_Click()
  2. On Error GoTo SubmitButton_Err
  3.  
  4. Email= DLookup("[email]", "Departments", "[Department] =Forms![FormName]![Dept]"
  5.  
  6.     If IsNull(Email) = False Then
  7.         DoCmd.SendObject , , , Email,"you@youremail.com" , , "Email Subject", "Email Body", True
  8.     Else: MsgBox "Are you sure there's an email address for this manager?.", vbInformation, "Check Email Address"
  9.     End If
  10.  
  11. SubmitButton_Exit:
  12.     Exit Sub
  13. SubmitButton_Err:
  14.     MsgBox Error$
  15.     Resume SubmitButton_Exit
  16. End Sub
Assumptions:
  • A textbox called 'Dept' on form contains the value of 'Department' from the table 'Departments'
  • The button is called SubmitButton
If you want to lookup the Manager too; make another DLookup with 'Manager' instead of Email.
Oct 9 '08 #2

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

Similar topics

2
by: Tom | last post by:
I am trying to store information into a table that has an auto increment field. There is currently no data in the table. Using the code below I cannot insert data into the table. I get an error...
6
by: Corepaul | last post by:
I am new to Access 2000. My operating system is Windows 2000. In the early stage of development I noticed something weird. On my form, I have a Command Button named "btnAlbumUp". The first time...
9
by: Alan Mackenzie | last post by:
To all those who use (X)Emacs's CC Mode to edit C, C++, Java, Objective-C, Pike, AWK or IDL: To help direct the development of CC Mode, it would be useful to find out how people use the...
20
by: Vijay Kumar R. Zanvar | last post by:
Hello, Unlike register, auto keyword can not be used to declare formal parameter(s). Is there any specific reason for this? Kind regards, Vijay Kumar R. Zanvar
5
by: Paulovič Michal | last post by:
hi all, I have problem with SERIAL field type (or sequence functionality). I have table with three columns - ID, IDS, NAME. I want auto-increment IDS grouped by ID. Example: 1, 1, Ferdo 1, 2,...
13
by: S.Dickson | last post by:
I had an access database that i use as an ordering system. I have a form for entering customer details. When i add a new customer on the form the customer number is an auto number that appears when...
11
by: mp- | last post by:
I want to be able to allow people to check their email from my PHP online application. Given only the users 1) email address, 2) username (if applicable) and 3) password - how can I auto detect...
10
by: laredotornado | last post by:
Hi, I'm using php 5. Does anyone have any code or a function that auto submits a form that contains a single INPUT, of type = file? Thanks, - Dave
3
by: TS | last post by:
I am using IE 7. I have a website running on my local machine (localhost) and auto complete doesnt work for any of the textboxes, but going to web sites on the internet does support this so i know...
21
by: JOYCE | last post by:
Look the subject,that's my problem! I hope someone can help me, thanks
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.