Send an e-mail from my contacts form

B

BillD

I don't know if I am in the right discussion group if not please tell me
where to go.

I have a form in my database that is in a tab control with 4 tabs. The first
tab is for contacts. What I would like to know is there anyway that I can
send an e-mail to the contact after I get the information entered. I set my
contacts table e-mail field to hyperlink so the e-mail data is in Blue and
Underlined, however it does not show up on the form that way even when I
refresh the form. I tried using a text box with a DLookup but that did not
work either.
I don't want to use addresses in Outlook just the address I enter in the
database and do not need to store the address in outlook either.
I don't know if this would be done with a command button and a macro or what.
If it is possible to do this and it requires code please let me know where I
would enter that as far as if it goes in an event procedure or a command
button or what. Also could you give me the code if that is the way this has
to be done.
I am a novice still at Access and especially with something like this
getting into another program.
Thanks
 
P

Pete D.

Delete the field on the form and recreate it draging the field from the
table list. It will now work. I have this behavior if I change the table
after creating the form field, it sometimes doesn't change to hyperlink on
the form.
 
B

BillD

Hi Pete,
I did as you said and added the field from the contacts table. When I enter
an e-mail address in the e-mail field it underlines and changes to blue,
however when I click on it to send an e-mail I get either error messages or a
web site for the email server opens. I tried to send one e-mail to a
comcast.net address and got the following message "Cannot Find '(null)'. Make
Sure Path or Internet Address is Correct". Another address was to a
Frontiernet.net and when I clicked on the address the Frontier web site
opened.
My Outlook program is open and minimized when I do this if you are wondering.

Would this have anything to do with a filter problem I am having that I
cannot remove. When I open my contacts form none of the fields populate and
none of the command buttons work until I go to "Records", "Remove Filter"
then everything works fine. I checked the form properties and the filter
field shows (((tblcontacts.LastName Is Null))) AND ((tblcontacts.LastName Is
Null)) the Data entry field is set to no. In the Advance Filter/Sort there is
Nothing in the filter that is there. I removed the filter in the form
properties but everytime I close and open the form the filter data returns on
it's own and I have no idea how to get rid of it.

If this could be the problem do you know how I can get rid of the filter,
where I would look to remove what ever is automatically entering that filter
information
 
P

Pete D.

Is the address prefixed with mailto: Sounds like it isn't seeing it as a
email address but a standard web site. 2007 does have a (I call it sticky
filter) but if after converting the file and forms you turn it off and save
it the form without the filter it goes away. I havn't had time to play with
this problem or a reason to but someone may jump in and answer that
question.
 
B

BillD

No there is no mailto infront of the address. All it shows on the form and
the table is for example: (e-mail address removed) or (e-mail address removed)

If I have to have the mailto infront of the address do I have to type that
in everytime or is there a way to have that entered for me either in the
address or behind the scenes. If there is a way could you kind of explain it
is easy to understand terms as I am still rather new to some things in Access.
Thanks
 
P

Pete D.

Just for fun, add mailto: infront of a couple of addresses and see if they
works. Then we can look at the details. I just want to make sure we are on
the right track. Right click on the field to edit hyperlink. Pete
 
B

BillD

Ok I added mailto: to three address and then clicked on them and the mail
opened just fine.

So where to from here. Is it possible to have mailto populated automatically
or do I just enter that each time

Thanks
 
P

Pete D.

Okay, put form in design view, select field and open properties. Select
after update and then the ... button. It will give you a vba window. My
field is EmailName so use your field name. See below to have it fix your
problem. Pete

Private Sub EmailName_AfterUpdate()
EmailName = "mailto:" & EmailName
End Sub
 
B

BillD

Entered the code like you said. When I type in the e-mail address it shows up
as Mailto:email address. However when I click on the e-mail address in the
form I get the following Cannot Find '(null)'. Make Sure the path or internet
address is correct. I know it is correct because I used my own email address
then when I typed in another address it opened a web site.
Here is a copy paste of the code I entered

-- Private Sub CoEMail_AfterUpdate()
CoEMail = "Mailto:" & CoEMail

End Sub
BillD
 
P

Pete D.

I was afraid you might have a problem as hyperlink address isn't the best
way to do it. Did you change records and go back or after tabbing out go
back and click the hyperlink. Would you be intrested in some VBA to make it
more dependable? What email program do you use?
 
B

BillD

I tried it both ways. Once I tabbed to another field and then clicked on the
e-mail and got the error messages. I then tried it by entering the e-mail and
going to another record when I went back and clicked on the e-mail I got the
error message again.
I then went in and deleted the function code that you had me enter and when
I would type in the email address I could click on it and it would open the
email with the address filled in.
If code would work that would be great All I would need from you is the code
written out and where in the event I should put it (i.e. after update) My
e-mail is Microsoft Outlook 2003
Thanks Pete
 
P

Pete D.

One quick test, put code back and test it (I know it might fail, just want
same error before next step). Then right click hyperlink field and select
edit hyperlink and see what it says. Top item is what is displayed, bottom
line is what the link actually is. If you can tell me what it is maybe I
can fix the hyperlink. Pete
 
B

BillD

Hi Pete,
Entered the code you told me to in the form field
Private Sub CoEmail_AfterUpdate()
CoEMail = "MailTo:" & CoEMail
End Sub

I then entered an e-mail address that appeared in the form and table as
MailTo:[email protected]
When I moved out of the field and then back and clicked on it I got the
error message "Cannot Find '(null)'. Make sure the path or internet address
is correct.
I also closed out the entire database and reopened it and when I clicked on
the address I got the same error message.

Followed your directions and went into edit hyperlink with the following
results showing:

Top Line Text to Display: Mailto:[email protected]
Bottom Line Address: http://[email protected]

I don't know if this is related but I have a filter problem that I can't get
rid of no matter what I do. When I delete and save the form or database and
then reopen it the filter comes back on it's own. The filter reads:
(((tblcontacts.LastName IS Null))) AND ((tblcontacts.LastName IS NUll))
I have been trying to get some help on this one also but so far no one has
been able to figure out why the filter keeps coming back. When the filter is
on I do not see the first record in the table contacts and none of the
command buttons work. When I go to Records and click on Remove filter
everything works fine. Just thought I would see if that could be part of the
problem since the error message reads "Cannot Find '(Null)'
Thanks
 
B

BillD

Pete,
I don't know if this is a programming thing or not or if you would be
willing to try and help but I have a filter problem that no one has been able
to help me with. I was working with a bhicks11viaAccessMonster... and he/she
was unable to help me find the problem.
If you would be interested in taking a look at it I can either send you all
the information I got from bhicks or perhaps you could look at what we mailed
back and forth.
The discussion group is "Forms" and the date of the problem was 08-10-08
with the title of the message "Form Filter Will Not Delete"
If this is something that you would not want to get into could you direct me
to the proper discussion group to resubmit my question
Thanks
 
P

Pete D.

You know I actually have a problem with the filter also. My best solution
would be when opening the form to turn off the filter in the on open event.
I'll fix mine which I have ignored so far and post a quick fix on it.
Funny I haven't seen anything on this in 2007 info. I only have it with
files I have converted from older formats. Also most were quick fixes where
I used a MS template from an older version. One I fixed by opening all the
forms and clearing all filters, setting filter off and saving but it didn't
work on others. Get back to you on this one as now you have me thinking.
Pete
 
B

BillD

Ok that didn't work unless I am typing it in the wrong place.
I went to edit hyperlink and in the address where it read http:// I changed
it to MailTo://
However when I went back to the form and typed in an e-mail address the
address showed up in the form as MailTo:[email protected] but I still
got the error message. I opened the edit hyperlink and the address at the
bottom of the window changed back to http://[email protected]

Is there someplace else I am suppose to enter that. I followed your
instructions from a previous response.
 
P

Pete D.

First look at this
http://office.microsoft.com/en-us/outlook/HP052428041033.aspx
which explains some of the hyperlink abilities. Please realize that the
outlook ones are specific to outlook not international but mailto is
available in all (for the picky 99.9%) of programs and uses the default mail
program. What I wanted you to try was

Private Sub CoEmail_AfterUpdate()
CoEMail = MailTo:// & CoEMail 'After the quote is comments and this is the
Changed line
End Sub

Let me know if this works as everything I have tried in all my availble
versions worked with the first code I sent you. Problem is I have a lot of
extra programs installed such as developer and Studio and anyone of them
might of made mine work different from yours.
 
B

BillD

Pete,

I don't know what the problem is maybe there is something else in the
database causing this to happen. I entered the code in the event procedure
and still get the same error message. I am starting to think there is
something wrong as I also have that filter problem that I cannot find out how
to get rid of no matter what I do.

After I entered the code you sent me I tried to open an email again and got
the same error message. Once I removed the event code and then clicked on the
email address it opened an email right away with no problem.

I think until I find out what the filter problem is and where it is at I am
better off just leaving that event procedure out and typeing in the entire
mailto: with the address.

I am sorry to have waisted so much of your time but there has got to be
something else going on with this form.

Thanks for all of your help though I did learn a lot that I will keep in my
files so if I ever get the problem worked out I can use what you have showen
me.
Perhaps I just need to rebuild this entire database from scratch and see if
it will work then.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top