473,587 Members | 2,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hyperlinks, input masks, and sending email in Access 2007

269 Contributor
I've been trying to figure this out for three weeks. I've been sleeping on it. Not getting answers, just losing sleep. ;-)

In a table, I have a field COMPANY_EMAIL. In this field I want to allow up to 8 characters, use the same domain always, and in a form be able to click and open an email to this customer. I have tried this in numerous ways, and I think it's occuring to me finally I can't do everything in one place. I think I might need a button.

I'm using <aaaaaaaa!"@dom ain"."com" in my input mask. This is pretty good, except if the address is only 4 letters, it leaves 4 spaces on the left side. I don't like that. Ideas?

I have put a button next to the email field in the form (as opposed to trying to use a hyperlink and an input mask...that got me nowhere fast). Right now the button is just sitting there. I know I'll need some code probably behind "on click" but I don't know what to put there to open an email to the address specified. Ideas??

I'm aware of the mailto: part...I tried to use one field as a hyperlink with the mailto: and domain.com all in the input mask (to end up with mailto:xxx@doma in.com) but sometimes, say for instance if the address was mbo@domain.com, the "m" would replace the "m" in mailto: and the "bo" would go in as the email address. When I chose an address that would go in correctly and clicked it in the form, it would never open an email anyway...so I'm trying to come up with a new plan...like the button plan above.

I need your guidance/ideas, so throw some at me!!!
Thank you so much for your time, patience, and brains! :-)
Oct 21 '09 #1
21 7955
NeoPa
32,566 Recognized Expert Moderator MVP
I'm not too hot on mailing from an application. Whenever I tried it the side issues put me off. There are a whole bunch of threads (some in which I'm involved) which deal with security problems etc etc.

Having said that, I can certainly help with the interface and how to make up, and even store, the email addresses.

Let's start with a question. Do you really want the "@blah blah.com" bit to be entered by the operator and/or saved? I would consider including that as static on the form in a Label control and just dealing with the name part in the interface.
Oct 21 '09 #2
DanicaDear
269 Contributor
I could definetely be convinced to go one way or the other. You see, I am just doing what I can comprehend on Access...I'm not yet familiar with all the other, better ways things can be done. I'm learning A LOT here on BYTES. In fact, BYTES has probably made this project a success instead of a failure for me.
So, it seems you encourage me to just deal with the first part of the email address. I can go that route, I'll just need some guidance on how to get the @domain.com connected. The people that will be using the DB are far less computer savvy than I am, so I wanted to make it easy for them to open an email to the customer. Persuade me in a direction...you r advice so far has been phenominal. :-)
Oct 22 '09 #3
ADezii
8,834 Recognized Expert Expert
@DanicaDear
Danica, what is your E-Mail Client (Outlook, Internet Explorer, etc.)?
Oct 22 '09 #4
DanicaDear
269 Contributor
Danica, what is your E-Mail Client (Outlook, Internet Explorer, etc.)?
I use MS Outlook. Thanks.
Oct 22 '09 #5
ADezii
8,834 Recognized Expert Expert
It should be a relatively simple matter to automate the process of send an E-Mail to a specific Address within Outlook, but first:
  1. Where are you obtaining the E-Mail Address from? If it is a Field on a Form, then what is the Field Name (txtEMailAddres s, txtCompany, etc.)?
  2. Do you want the E-Mail automatically sent with Default Body Text and Subject, or do you simply want the Outlook Window open with the To: and Subject: automatically filled in, and leave the Body: to you?, etc...
Oct 22 '09 #6
DanicaDear
269 Contributor
1. Field COMPANY_EMAIL in table HOTSTICK_CUSTOM ERS and form HOTSTICK_CUSTOM ERS. (I was educated on better naming after I named everything...wi ll do better in the future.) Also note, I changed the name to appear as "Email" to the user. But I think the program writer is mostly concerned with the name that shows in design view...which is COMPANY_EMAIL.
2. I want to open an email and leave both the subject and the body as the user's responsibility. I can see where I might eventually in the future want to automate things much more but for now I'm just a beginner and I could spend a year writing this DB if I don't watch it. ;-) (Why am I suddenly laughing out loud?)

The lab freqeuntly sends out saved emails where sometimes it would likely be easier to copy and paste the email address from Access to Outlook. On other occasions, they might want to send a unique email and that is where clicking the email address in the Access program would be more helpful. That's why I initially tried to create one text box with the domain attached and make it a hyperlink...so I could have flexibility to copy or click. I'm still open and conviceable. You people know lots more than me. I tend to take good advice. Thanks again, Danica
Oct 22 '09 #7
ADezii
8,834 Recognized Expert Expert
The following code will:
  1. Perform minimal validation on the E-Mail Address as entered into the [COMPANY_EMAIL] Field.
  2. Open a Session of Microsoft Outlook with the chosen E-Mail Address as entered into the [COMPANY_EMAIL] Address Field as the To: segment.
  3. Leave the Subject and Body empty for the User to fill in.
  4. Simply fill in the missing info then Send.
  5. Be sure to set a Reference to the Microsoft Outlook XX.X Object Library before you attempt to execute this code.
Expand|Select|Wrap|Line Numbers
  1. 'YOU MUST FIRST SET A REFERENCE TO THE OUTLOOK XX.X OBJECT LIBRARY
  2. Dim oLook As Object
  3. Dim oMail As Object
  4. Dim olns As Outlook.Namespace
  5. Dim strEMailAddress As String
  6. Dim txtEMail As TextBox
  7.  
  8. Set txtEMail = Me![COMPANY_EMAIL]
  9.  
  10. 'Let's at least perform Minimal Validation
  11. If IsNull(txtEMail) Then
  12.   MsgBox "No E-Mail Address listed", vbCritical, "Missing E-Mail Address"
  13.     txtEMail.SetFocus
  14.       Exit Sub
  15. ElseIf InStr(txtEMail, "@") = 0 Or InStr(txtEMail, ".") = 0 Then
  16.   MsgBox "Invalid E-Mail Address", vbCritical, "Invalid E-Mail Address"
  17.     txtEMail.SetFocus
  18.       Exit Sub
  19. End If
  20.  
  21. strEMailAddress = txtEMail
  22.  
  23. DoCmd.Hourglass True
  24.  
  25. Set oLook = CreateObject("Outlook.Application")
  26. Set olns = oLook.GetNamespace("MAPI")
  27. Set oMail = oLook.CreateItem(0)
  28.  
  29. With oMail
  30.   .To = strEMailAddress
  31.   .Body = ""
  32.   .Subject = ""
  33.     .Display
  34. End With
  35.  
  36. Set oMail = Nothing
  37. Set oLook = Nothing
  38.  
  39. DoCmd.Hourglass False
Oct 22 '09 #8
NeoPa
32,566 Recognized Expert Moderator MVP
@DanicaDear
OK. For the sake of this we'll assume that the domain part of the email address is to be @Domain.com. We can also work on an eight character name part if you like, but I expect you can handle that in the design of your form (and control). You would need to change what type of data is expected in [COMPANY_EMAIL], as well as add a Label control after it which displayed the domain name. The Label control (Let's call it lblDomain) would display @Domain.com. This is easily changed in Design View for a different domain of course.

What I'm suggesting here is easily incorporated into ADezii's code. It would simply replace line #8.
Expand|Select|Wrap|Line Numbers
  1. Set txtEMail = Me![COMPANY_EMAIL]
All we do really is add the domain address (conveniently found in lblDomain) to the end of [COMPANY_EMAIL] to produce the full address :
Expand|Select|Wrap|Line Numbers
  1. Set txtEMail = Me.[COMPANY_EMAIL] & Me.lblDomain.Caption
Otherwise, I'm sure ADezii's code will work fine for you (not that it wouldn't without this suggestion you understand).
Oct 22 '09 #9
DanicaDear
269 Contributor
Thanks everyone. I'm off til Monday. Will get restarted then. I'm soooo tempted to try this right away (because I will admit this project is kind of exciting). However, 40 hours of Access is enough in a week so I definitely need to take my breaks so I don't get burnt out. (Plus I have the cutest little one year old!) :-)
Y'all have a nice weekend.
Oct 23 '09 #10

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

Similar topics

6
12698
by: dude | last post by:
hello how would i make an input mask that only makes the first letter a capitol one? i've been playing around and testing various masks, also tried the wizard, but i've had no luck. could anyone help, many thanks in advance.
2
3051
by: Mark Lees | last post by:
I want to create an input mask for a phone number and I would like the area code to always be (801). However, I want the users to be able to edit it if necessary. Would it look like this = !"(801) 000\-0000;;_" ?
6
3944
by: Colleyville Alan | last post by:
I have an application that has an Access table that stores the locations of slides in a Powerpoint file. This used to work fine when there were about 4 files and 200 slides. The database would open all four PPT files at once, and would loop through queriers for ever client and create custom presentations. Now there are 8 files, nearly 500...
4
3030
by: David W. Fenton | last post by:
I'm working on a subform where users put in 24-hour time. On their paper forms, they've been accustomed to referring to midnight as 24:00 (instead of as 0:00, which kind of makes sense from a human point of view, though it's still wrong, as it puts midnight as the end of the previous day instead of the beginning of the next, but it avoids the...
11
4423
by: MS | last post by:
The simplest input mask for peoples names is.... >L<?????????????? But what about when you have names like MacDonald, or Mary-Anne? Anyone come up with a good "all round" "idiots" mask that still applies capitals and lower case when required - even for Mac and hyphens?
7
7038
by: F. Michael Miller | last post by:
I have a db with Access front end, sql back, linked tables. I need to be able to change input masks at the table level in code. Any ideas? Thanks!
16
12679
by: Filips Benoit | last post by:
Dear all, I have a datefield that sometimes should store hours and minutes too ans use following format and inputmask. dd/mm/yyyy hh\:nn 09/09/0000\ 99:99;0;* Typing date, hour and minutes is OK.
12
3173
by: panjap | last post by:
a few days a go i was kindly helped with the trouble i was having on editing lables wjhere i wanted to change access' messages to my own. Below si the qeustion i set a few days agoa , which worked brillintantly with the answer posted below If I follow your logic correctly, you wish to replace the Standard Acces Error message with a...
1
12234
by: Doug | last post by:
Hi, I created a short date field. The format is dd/mm/yyyy when displayed. The input mask is set to 99/99/00;0 (default, I didn't type anything). If I edit an existing date, say change 12/14/2007 to 12/15/2007, I get an error "the value you entered isn't appropriate for the input mask." I have to delete the "20" in the year to get it...
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.