Email Address Format (1 Viewer)

Guy Boswell

Registered User.
Local time
Today, 02:47
Joined
Jul 20, 2009
Messages
26
I am using a module to make and send an email message.
I am using MS Access 2003 SP2 and MS Outlook 2003 SP2 in Windows 2000 Professional SP4 in an Agency network where everything is locked down and I can't generally get at any settings!
All works fine up to the point when I send the email using command,
DoCmd.SendObject acSendNoObject, , , tblRecipients!fldEmail, , , "URGENT - Flood Warning to issue", strFloodlineMessage, True
That opens Outlook, populates the message with the correct subject and message content and allows editing before send - all as I want.
The problem is the address. If I look on the table tblRecipients the field fldEmail is name.surname@environment-agency.gov.uk
But the address posted in to Outlook is name.surname@environment-agency.gov.uk #http:// name.surname @ environment-agency.gov.uk (without the spaces) and that doesn't work.
the fldEmail is type Hyperlink
Where am I going wrong?
 
Last edited:

ajetrumpet

Banned
Local time
Yesterday, 20:47
Joined
Jun 22, 2007
Messages
5,638
most likely your email message is being written in HTML and hyperlinks are anchor tags in that language, so it looks like it's capturing that as it, literally. with your email references, try using cstr() to get the hyperlink property out of there. for example:

PHP:
ol.address = cstr(rs!email)
 

HiTechCoach

Well-known member
Local time
Yesterday, 20:47
Joined
Mar 6, 2006
Messages
4,357
... the fldEmail is type Hyperlink
I find using the Hyperlink data type very troublesome and harder to use. I use a plain text data type.

From the help file:

The CreateHyperlink procedure in the following example sets the hyperlink properties for a command button, label, or image control to the address and subaddress values passed to the procedure. The address setting is an optional argument, because a hyperlink to an object in the current database uses only the subaddress setting, To try this example, create a form with two text box controls (txtAddress and txtSubAddress) and a command button (cmdFollowLink) and paste the following into the Declarations section of the form's module:

Code:
Private Sub cmdFollowLink_Click()
    CreateHyperlink Me!cmdFollowLink, Me!txtSubAddress, _
         Me!txtAddress
End Sub

Sub CreateHyperlink(ctlSelected As Control, _
     strSubAddress As String, Optional strAddress As String)
    Dim hlk As Hyperlink
    Select Case ctlSelected.ControlType
        Case acLabel, acImage, acCommandButton
            Set hlk = ctlSelected.Hyperlink
            With hlk
                If Not IsMissing(strAddress) Then
                    .Address = strAddress
                Else
                    .Address = ""
                End If
                .SubAddress = strSubAddress
                .Follow
                .Address = ""
                .SubAddress = ""
            End With
        Case Else
            MsgBox "The control '" & ctlSelected.Name _
                 & "' does not support hyperlinks."
    End Select
End Sub

You will need to use
 

HiTechCoach

Well-known member
Local time
Yesterday, 20:47
Joined
Mar 6, 2006
Messages
4,357
... the fldEmail is type Hyperlink
I find using the Hyperlink data type very troublesome and harder to use. I use a plain text data type.

From the help file:

The CreateHyperlink procedure in the following example sets the hyperlink properties for a command button, label, or image control to the address and subaddress values passed to the procedure. The address setting is an optional argument, because a hyperlink to an object in the current database uses only the subaddress setting, To try this example, create a form with two text box controls (txtAddress and txtSubAddress) and a command button (cmdFollowLink) and paste the following into the Declarations section of the form's module:

Code:
Private Sub cmdFollowLink_Click()
    CreateHyperlink Me!cmdFollowLink, Me!txtSubAddress, _
         Me!txtAddress
End Sub

Sub CreateHyperlink(ctlSelected As Control, _
     strSubAddress As String, Optional strAddress As String)
    Dim hlk As Hyperlink
    Select Case ctlSelected.ControlType
        Case acLabel, acImage, acCommandButton
            Set hlk = ctlSelected.Hyperlink
            With hlk
                If Not IsMissing(strAddress) Then
                    .Address = strAddress
                Else
                    .Address = ""
                End If
                .SubAddress = strSubAddress
                .Follow
                .Address = ""
                .SubAddress = ""
            End With
        Case Else
            MsgBox "The control '" & ctlSelected.Name _
                 & "' does not support hyperlinks."
    End Select
End Sub

You will need to use
 

ajetrumpet

Banned
Local time
Yesterday, 20:47
Joined
Jun 22, 2007
Messages
5,638
i personally find double postings difficult to comprehend. laughing.... :p :p:p
 

dbDamo

Registered User.
Local time
Today, 02:47
Joined
May 15, 2009
Messages
395
I have always used text Data Type for email addresses. I have just tested my Database having changed my email address field's Data Type to hyperlink and it doesn't work, so I think that is your problem. If you could paste your code I would be able to confirm the problem.

If this is the case then unfortunately the solution won't be as simple as changing the field's Data Type to text as this adds '#http://' & repeats the email address after the original email address.
 

Guy Boswell

Registered User.
Local time
Today, 02:47
Joined
Jul 20, 2009
Messages
26
Thank you dbDamo et al. It was as simple as changing field data type to text. Not sure why I had hyperlink in there in the first place. I think it might be because I recycled the table from one I created as an Outlook export a while ago. And it seemed like maybe not the right type but probably the most relevant type. But it wasn't. Text works fine :)
 

HiTechCoach

Well-known member
Local time
Yesterday, 20:47
Joined
Mar 6, 2006
Messages
4,357
Sorry about the double post.

I really was not trying to post the same thing twice. I am not sure how I managed to do it.
 

Users who are viewing this thread

Top Bottom