[ Taste And See ]
Smiles & Victory at Every Turn!Email Hyperlinks in MS Access, and other things...
2007-06-02
This has absolutely nothing to do with the theme of my blog but I get so involved in database design (it's like a hobby for me.)
I'm currently updating an antiquated Access 97 database at work. It's a personal desire to do this contractually for a living, I'm really not that good at it but this opportunity at work is a great way to prove my current skill level.
Emails from your database...
One thing people would like to be able to do with their contact database is send emails directly from the contact information page/form. I'm not a professional at this but I really wanted to tackle this one. I did some internet searching looking for a solution. I came accross some articles on how to send an email directly from the database. That wasn't exactly what I was looking for. What I wanted was a hyperlink to direct email. You know, you point your mouse to the email and it turns into a hand and you click and it opens your default email programs new message with the person's email right there. Now, in Access, you can have a hyperlink field and use it for such but here are some of the problems with that solution:
Access formats your address (whatever you type in for that field) as a web address. For instance, you type "www.mywebpage.com" and Access formats your page as an actual hyperlink "http://www.mywebpage.com" That's great, for web pages. I want to send emails. If you type, "bro_chris@myemail.com" Access formats your email address as a web page "http://bro_chris@myemail.com" (it doesn't know better) and when you hover over it you get the fancy hand pointer mouse, but when you click Access opens your web browser (not your email program) and attempts to view your email address as a web page. Obviously, this doesn't work. Well, you can make Access go to email manually by typing "mailto: bro_chris@myemail.com" and it works fine except A) you hyperlink always reads "mailto: bro_chris@myemail.com" which users don't aways understand and B) how many average users know that they need to type "mailto:" every time. Most applications do that thinking for them.
So what did I do to solve this? I read an article in a book about how I could programatically change the address after it's keyed. This works but... It still reads "mailto: bro_chris@myemail.com" and I didn't like it. The solution came to me. I'll make a button do this. I tried command buttons but I couldn't figure out how to run the same action that takes place with the mouse over hyperlink does, that was the effect I wanted. I came up with another solution. I made a text box and had it reflect the email address formated as an email address. How so? I added a field in the query that the form was based on. That field was called "email" and it was formatted as such: =IIF(IsNull([emailaddress]),"","mailto:" & [emailaddress]) So, when you hover over that text box, vuala! the imfamous hyperlink mouse over affect, but, you see this akward extra email box that shows that strange "mailto: bro_chris@myemail.com" Not very attractive... So what did I do? I did a couple cool things to resovle this. One, I changed the text color to match the background color so it was invisible. Second, I made the text box smaller and formatted it to look like a button. Now I have a button that does the same work. People were happy to see this new addition. A simple solution. I'm sure there are better and if you know of one, please share it. I always like a better solution.
So you want to merge your record (the current one or a batch of letters) try this: http://www.members.shaw.ca/AlbertKallal/wordmerge/page2.html
This man, Albert Kallal, made a total solution for anyone's Access database. All you do is import the modules and a couple forms. You add a command button to your form (any form that contains the the data you want to merge.) and add to the onclick event one line of code: MergeSingleWord. That's it. Open your form and click on the button and watch the magic happen before your eyes. This was another solution the people I work for wanted. The glory of this revelation is this: "You don't have to be a super programmer to build dynamic applications. The key is knowing how to find solutions and import them in to your application." Many thanks to Albert Kallal, your solution is working great.
Anyone else interested in Access databases and VBA? Please drop me a line.
Created with ShoutPost