What's up with this???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

So I tried to fix my hyperlink field for my email so it would add the
'mailto:' in front of what a user types in. Here's what I have.

Private Sub Email_AfterUpdate()
' If you just type in an email name: (e-mail address removed)
' Access changes it to: [email protected]#http://[email protected]# !!
' This code tries to fix it
Dim intI As Integer
' Don't do anything if email is empty
If IsNull(Me.PMemailAddress) Then Exit Sub
' Fix up http:// if it's there
Me.PMemailAddress = Replace(Me.PMemailAddress, "http://", "mailto:")
' Now look for the first"#" that delimits the hyperlink display name
intI = InStr(Me.PMemailAddress, "#")
' And put the person name there instead if found
If intI > 0 Then
Me.PMemailAddress = (Me.PMemailAddress + " ") & Me.LastName & _
Mid(Me.PMemailAddress, intI)
End If
End Sub

When I try to type something in I get a compile error "Method or data member
not found. and it highlights the line before the End if,
Mid(Me.PMemailAddress,intI)

I don't get it. What's wrong.
 
Try this:

Private Sub cmdEmail_Click()
Dim strMail As String
strMail = "#MailTo:" & Me.txtEMail & "#"
Application.FollowHyperlink HyperlinkPart(strMail, acAddress)
End Sub

The above uses a plain text field and textbox (txtEmail) to mail from an
email address in the database. Three advantages:

1. Your problem is solved
2. Larger file size of hyperlinks is eclipsed
3. Less chance of corruption
 
Okay, thanks. So I should change my email field from a hyperlink to a plain
text field?
 
You have PMemailAddress and Arvin has txtEMail

You need to alter Arvin's code to what you use on your on form so that it
works for you.

: - )
 
It doesn't change anything, it emails correctly formed email addresses when
you click on the button named cmdEmail. If you have http://whatever in the
hyperlink, you'll need to delete anything that's not part of the email
address after you've changed the table's field from hyperlink to text.
 

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

Similar Threads

My code 3
Removing character 1
Delete all Relationships 4
space in word 1
Access Access 2000 How to Select List Box Item on Form Open 0
Can't make sense of this 3
CustomDocumentProperties 7
Extract files from BLOB corrupts PDF 11

Back
Top