My code

F

Freehal04

Can you tell me what is wrong with "IsNothing" in my code?

Private Sub Email_AfterUpdate()
' If you just type in an email name: [email protected]
' 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 IsNothing(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
 
M

missinglinq via AccessMonster.com

Right off hand, IsNothing() is not an Access function! I suspect you want
IsNull()
 
F

Freehal04

You were right, Null is the right function. Now the second to last line is
giving me an error:

f intI > 0 Then
Me.PMemailAddress = (Me.PMemailAddress + " ") & Me.LastName & _
Mid(Me.PMemailAddress, intI)

It's telling me that .PMemailAddress is a Compile error: Method or data
member not found. What does that mean? It doesn't have a problem with it in
5 previous times it shows up, in the same code? I don't get it?

Freehal
 
M

missinglinq via AccessMonster.com

The thing you have to understand is that Access frequently hilites not the
line causing the problem, but the line FOLLOWING the line causing the problem.
If you've accurately copied and pasted your code here, the problem is you
have

f intI > 0 Then

when you should have

If intI > 0 Then
 
Top