email address link

M

maizura

I would like, to do the link at text box if the data at
the field is email address ex:


text box: (e-mail address removed)
When click at this address, it will open outlook express
or microsoft outlook. How to i set the linking. tq.
 
A

Alfred

maizura said:
I would like, to do the link at text box if the data at
the field is email address ex:


text box: (e-mail address removed)
When click at this address, it will open outlook express
or microsoft outlook. How to i set the linking. tq.

Try the following
' test for @ to see if it is a valid email address
Private Sub DbGeneralEmail_AfterUpdate()
If InStr([DbGeneralEmail], "@") = 0 Then
MsgBox " Not a valid email address"
[DbGeneralEmail] = " "
End If
End Sub

2.0 Use the following to open outlook and insert email address. Repplace
DbGeneralEmail with your text box name

Private Sub DbGeneralEmail_DblClick(Cancel As Integer)
DbGeneralEmail.IsHyperlink = False
Dim olApp As Outlook.Application
Dim olMailMessage As Outlook.MailItem
Dim olRecipient As Outlook.Recipient
Dim blnKnownRecipient As Boolean
Set olApp = New Outlook.Application
Set olMailMessage = olApp.CreateItem(olMailItem)
With olMailMessage
.To = DbGeneralEmail.Value
'.BCC =
.Display
End With
Set olMailMessage = Nothing
End Sub
 
M

maizura

-----Original Message-----

maizura said:
I would like, to do the link at text box if the data at
the field is email address ex:


text box: (e-mail address removed)
When click at this address, it will open outlook express
or microsoft outlook. How to i set the linking. tq.

Try the following
' test for @ to see if it is a valid email address
Private Sub DbGeneralEmail_AfterUpdate()
If InStr([DbGeneralEmail], "@") = 0 Then
MsgBox " Not a valid email address"
[DbGeneralEmail] = " "
End If
End Sub

2.0 Use the following to open outlook and insert email address. Repplace
DbGeneralEmail with your text box name

Private Sub DbGeneralEmail_DblClick(Cancel As Integer)
DbGeneralEmail.IsHyperlink = False
Dim olApp As Outlook.Application
Dim olMailMessage As Outlook.MailItem
Dim olRecipient As Outlook.Recipient
Dim blnKnownRecipient As Boolean
Set olApp = New Outlook.Application
Set olMailMessage = olApp.CreateItem(olMailItem)
With olMailMessage
.To = DbGeneralEmail.Value
'.BCC =
.Display
End With
Set olMailMessage = Nothing
End Sub

maizura wrote: Thanks for your reply.

after compile error msg at:
Dim olApp As Outlook.Application
Dim olMailMessage As Outlook.MailItem
Dim olRecipient As Outlook.Recipient
Dim blnKnownRecipient As Boolean
Set olApp = New Outlook.Application

with message "user-defined type not defined". what should
i do.

tq.
maizura
 

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