email address link

  • Thread starter Thread starter maizura
  • Start date Start date
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.
 
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
 
-----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
 
Back
Top