473,397 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Database results - activating links within memo fields

When users of my site submit articles to our database
(http://www.netterweb.com/articles/) they almost always have http://
addresses within the text. They are pasting that text into a box which saves
to a memo field. When displayed through results on a webpage, the links are
inactive, unless the user was knowledgable enough to use html within the
text. However, most of my users are not html savvy. Is there a way I can
code the results of that field to make an active link out of any text
preceeded by "http://" ?

Thanks in advance for your help.

Mike
Nov 13 '05 #1
12 2039
magmike wrote:
When users of my site submit articles to our database
(http://www.netterweb.com/articles/) they almost always have http://
addresses within the text. They are pasting that text into a box which saves
to a memo field. When displayed through results on a webpage, the links are
inactive, unless the user was knowledgable enough to use html within the
text. However, most of my users are not html savvy. Is there a way I can
code the results of that field to make an active link out of any text
preceeded by "http://" ?

Thanks in advance for your help.

Mike

I suppose when you save the memo you could look for .com, .org, etc. If
it is found, go to that position and scan backwards until you hit a
space (stop and go up a character) or the beginning of the memo. Then
check if http:// is the next 7 characters. If not, you can
concatenate/insert the http://.

Nov 13 '05 #2
I'm kind of a hack and new to code. Can you give me an example to go by?

Plus, I think it would be better to search for http:// or www. and then go
forwards to a space, since some links will end with something after the .com
or .net.

Can you give me an example for that? Where would that fit into the SQL
statement that writes to the database?

thanks for your reply!
mike
"Salad" <oi*@vinegar.com> wrote in message
news:TV*******************@newsread1.news.pas.eart hlink.net...
magmike wrote:
When users of my site submit articles to our database
(http://www.netterweb.com/articles/) they almost always have http://
addresses within the text. They are pasting that text into a box which saves to a memo field. When displayed through results on a webpage, the links are inactive, unless the user was knowledgable enough to use html within the
text. However, most of my users are not html savvy. Is there a way I can
code the results of that field to make an active link out of any text
preceeded by "http://" ?

Thanks in advance for your help.

Mike

I suppose when you save the memo you could look for .com, .org, etc. If
it is found, go to that position and scan backwards until you hit a
space (stop and go up a character) or the beginning of the memo. Then
check if http:// is the next 7 characters. If not, you can
concatenate/insert the http://.

Nov 13 '05 #3
magmike wrote:
I'm kind of a hack and new to code. Can you give me an example to go by?

Plus, I think it would be better to search for http:// or www. and then go
forwards to a space, since some links will end with something after the .com
or .net.
I should have added...error checking will be required. Why wouldn't
"www" be sufficient? An easy example is google, I often go to their
"groups" search...ex http://groups.google.com. There is no "www". How
about MS? http://support.microsoft.com. Nary a "www" around.
Can you give me an example for that? Where would that fit into the SQL
statement that writes to the database?


I thought this was a memo field. If so, I would update it when the memo
is updated, in the afterupdate event of the memo. Ex:
If Len(me.MemoFieldName) > 0 then
Me.MemoFieldName = CheckHttp(Me.MemoFieldName)
Endif

Otherwise, in a query, you would use a function. If you wanted to
update the memo via a query, you'd drag the memo field to the query.
Make the query type Update. In the Update row enter
CheckHttp([YourMemoFieldName])

BTW, I would make a copy of the table before you run it the first time
to ensure it works correctly if you will be doing a mass update via a
query...but it appears to be OK from where I'm standing.

Anyway, here is code that should get you on track. This is the result
of the function when I called it from the immediate/debug window
? CheckHttp("This is a test of www.microsoft.com, www.google.com")
and it echoes
This is a test of http://www.microsoft.com, http://www.google.com

OK...so it works mostly. You need to put in the domain name stuff you
want to check for.
Function CheckHttp(varMemo As Variant) As Variant
Dim i As Integer
Dim intFor As Integer
Dim intPos As Integer
Dim intStart As Integer
Dim strHold As Variant

'change the counter and add any further domains to search for
Dim ar(5)
ar(1) = ".www"
ar(2) = ".com"
ar(3) = ".org"
ar(4) = ".info"
ar(5) = ".biz"

'scan each type
For i = 1 To 5 'change counter here if you add/subtract ar counts
'where to start searching in the memo
intStart = 1

'do forever
Do While True
'see if string searched for is found
intPos = InStr(intStart, varMemo, ar(i))

'exit forever if not found
If intPos = 0 Then Exit Do

'read backwards to first non-char or beginning of memo
For intFor = intPos To 1 Step -1
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Then
'kick up to first char after space
intFor = intFor + 1
Exit For
End If
Next intFor

If Mid(varMemo, intFor, 7) <> "http://" Then
varMemo = Left(varMemo, intFor - 1) & "http://" & _
Mid(varMemo, intFor)
End If

'start search beyond
intStart = intPos + Len(ar(i))

Loop
Next i

CheckHttp = varMemo
End Function
Nov 13 '05 #4
That's absolutely fantastic! How could I modify it to do the following:

1. add "<a href=" to the front of the link
2. add ">" to the end of the link
3. copy & repaste the link after ">"
4. then add "</a>" after that?

Is that even possible?

"Salad" <oi*@vinegar.com> wrote in message
news:VG***************@newsread3.news.pas.earthlin k.net...
magmike wrote:
I'm kind of a hack and new to code. Can you give me an example to go by?

Plus, I think it would be better to search for http:// or www. and then go forwards to a space, since some links will end with something after the ..com or .net.


I should have added...error checking will be required. Why wouldn't
"www" be sufficient? An easy example is google, I often go to their
"groups" search...ex http://groups.google.com. There is no "www". How
about MS? http://support.microsoft.com. Nary a "www" around.
Can you give me an example for that? Where would that fit into the SQL
statement that writes to the database?


I thought this was a memo field. If so, I would update it when the memo
is updated, in the afterupdate event of the memo. Ex:
If Len(me.MemoFieldName) > 0 then
Me.MemoFieldName = CheckHttp(Me.MemoFieldName)
Endif

Otherwise, in a query, you would use a function. If you wanted to
update the memo via a query, you'd drag the memo field to the query.
Make the query type Update. In the Update row enter
CheckHttp([YourMemoFieldName])

BTW, I would make a copy of the table before you run it the first time
to ensure it works correctly if you will be doing a mass update via a
query...but it appears to be OK from where I'm standing.

Anyway, here is code that should get you on track. This is the result
of the function when I called it from the immediate/debug window
? CheckHttp("This is a test of www.microsoft.com, www.google.com")
and it echoes
This is a test of http://www.microsoft.com, http://www.google.com

OK...so it works mostly. You need to put in the domain name stuff you
want to check for.
Function CheckHttp(varMemo As Variant) As Variant
Dim i As Integer
Dim intFor As Integer
Dim intPos As Integer
Dim intStart As Integer
Dim strHold As Variant

'change the counter and add any further domains to search for
Dim ar(5)
ar(1) = ".www"
ar(2) = ".com"
ar(3) = ".org"
ar(4) = ".info"
ar(5) = ".biz"

'scan each type
For i = 1 To 5 'change counter here if you add/subtract ar counts
'where to start searching in the memo
intStart = 1

'do forever
Do While True
'see if string searched for is found
intPos = InStr(intStart, varMemo, ar(i))

'exit forever if not found
If intPos = 0 Then Exit Do

'read backwards to first non-char or beginning of memo
For intFor = intPos To 1 Step -1
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Then
'kick up to first char after space
intFor = intFor + 1
Exit For
End If
Next intFor

If Mid(varMemo, intFor, 7) <> "http://" Then
varMemo = Left(varMemo, intFor - 1) & "http://" & _
Mid(varMemo, intFor)
End If

'start search beyond
intStart = intPos + Len(ar(i))

Loop
Next i

CheckHttp = varMemo
End Function

Nov 13 '05 #5
magmike wrote:
That's absolutely fantastic! How could I modify it to do the following:

1. add "<a href=" to the front of the link
2. add ">" to the end of the link
3. copy & repaste the link after ">"
4. then add "</a>" after that?

Is that even possible?


Here's a modification to my code. I'll give 2 examples
Ex#1:
? CheckHttp("This is a test of <a href=http://www.microsoft.com></a>,
www.google.com")

This returned the following:
This is a test of <a href=http://www.microsoft.com></a>, <a
href=http://www.google.com></a>

Ex#2
? CheckHttp("This is a test of http://www.microsoft.com, www.google.com")

ANd that returned.
This is a test of <a href=http://www.microsoft.com></a>, <a
href=http://www.google.com></a>

I would do more testing on this...I'm checking for spaces and commas
only. Take a few complicated memos you have and check the results. I
suppose people can goof things up with http://www.x.com> or not putting
"<a " in front of href= etc. As far as I'm concerned, if people don't
start getting creative with their punctuation and inserting their own
stuff into URLs then for the most part it should be OK.

Function CheckHttp(varMemo As Variant) As Variant
Dim ar(5)
Dim i As Integer
Dim intFor As Integer
Dim intPos As Integer
Dim intStart As Integer
Dim strHold As Variant

ar(1) = ".www"
ar(2) = ".com"
ar(3) = ".org"
ar(4) = ".info"
ar(5) = ".biz"

'scan each type
For i = 1 To 5
'where to start searching in the memo
intStart = 1

'do forever
Do While True
'see if string searched for is found
intPos = InStr(intStart, varMemo, ar(i))

'exit forever if not found
If intPos = 0 Then Exit Do

'read backwards to first non-char or beginning of memo
For intFor = intPos To 1 Step -1
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Then
'kick up to first char after space
intFor = intFor + 1
Exit For
End If
Next intFor

If Mid(varMemo, intFor, 7) = "http://" Then
varMemo = Left(varMemo, intFor - 1) & "<a href=" & _
Mid(varMemo, intFor)
ElseIf Mid(varMemo, intFor, 5) <> "href=" Then
varMemo = Left(varMemo, intFor - 1) & "<a
href=http://" & _
Mid(varMemo, intFor)
End If

'now get to the end of the link
For intFor = intPos To Len(varMemo)
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Or Mid(varMemo,
intFor, 1) = "," Then
'kick up to first char after space
intFor = intFor - 1
Exit For
End If
Next intFor

If Right(Left(varMemo, intFor), 5) <> "></a>" Then
varMemo = Left(varMemo, intFor) & "></a>" & _
Mid(varMemo, intFor + 1)
intStart = intFor + 5
Else
intStart = intFor
End If

Loop
Next i

CheckHttp = varMemo
End Function
Nov 13 '05 #6
Looking good - however, the link doesn't show in html because of the
emptyness between ">" and "</a>". How would we insert the link we just
modified in between there, so the code gets rendered, <a
href=http://microsoft.com>http://microsoft.com</a>?

Secondly, one problem I am finding, is that it is doing this to email
addresses. How do we skip email addresses? I think I can modify well enough
myself to run a seperate function to activate the email addresses with
mailto: instead of http://
"Salad" <oi*@vinegar.com> wrote in message
news:Sj*****************@newsread3.news.pas.earthl ink.net...
magmike wrote:
That's absolutely fantastic! How could I modify it to do the following:

1. add "<a href=" to the front of the link
2. add ">" to the end of the link
3. copy & repaste the link after ">"
4. then add "</a>" after that?

Is that even possible?


Here's a modification to my code. I'll give 2 examples
Ex#1:
? CheckHttp("This is a test of <a href=http://www.microsoft.com></a>,
www.google.com")

This returned the following:
This is a test of <a href=http://www.microsoft.com></a>, <a
href=http://www.google.com></a>

Ex#2
? CheckHttp("This is a test of http://www.microsoft.com, www.google.com")

ANd that returned.
This is a test of <a href=http://www.microsoft.com></a>, <a
href=http://www.google.com></a>

I would do more testing on this...I'm checking for spaces and commas
only. Take a few complicated memos you have and check the results. I
suppose people can goof things up with http://www.x.com> or not putting
"<a " in front of href= etc. As far as I'm concerned, if people don't
start getting creative with their punctuation and inserting their own
stuff into URLs then for the most part it should be OK.

Function CheckHttp(varMemo As Variant) As Variant
Dim ar(5)
Dim i As Integer
Dim intFor As Integer
Dim intPos As Integer
Dim intStart As Integer
Dim strHold As Variant

ar(1) = ".www"
ar(2) = ".com"
ar(3) = ".org"
ar(4) = ".info"
ar(5) = ".biz"

'scan each type
For i = 1 To 5
'where to start searching in the memo
intStart = 1

'do forever
Do While True
'see if string searched for is found
intPos = InStr(intStart, varMemo, ar(i))

'exit forever if not found
If intPos = 0 Then Exit Do

'read backwards to first non-char or beginning of memo
For intFor = intPos To 1 Step -1
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Then
'kick up to first char after space
intFor = intFor + 1
Exit For
End If
Next intFor

If Mid(varMemo, intFor, 7) = "http://" Then
varMemo = Left(varMemo, intFor - 1) & "<a href=" & _
Mid(varMemo, intFor)
ElseIf Mid(varMemo, intFor, 5) <> "href=" Then
varMemo = Left(varMemo, intFor - 1) & "<a
href=http://" & _
Mid(varMemo, intFor)
End If

'now get to the end of the link
For intFor = intPos To Len(varMemo)
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Or Mid(varMemo,
intFor, 1) = "," Then
'kick up to first char after space
intFor = intFor - 1
Exit For
End If
Next intFor

If Right(Left(varMemo, intFor), 5) <> "></a>" Then
varMemo = Left(varMemo, intFor) & "></a>" & _
Mid(varMemo, intFor + 1)
intStart = intFor + 5
Else
intStart = intFor
End If

Loop
Next i

CheckHttp = varMemo
End Function

Nov 13 '05 #7
I keep getting this error when I run either function:

Run-time error '94':

Invalid use of Null

The dubugger then points to following line in the code:

intPos = InStr(intStart, varMemo, ar(i))

Any clues?

"Salad" <oi*@vinegar.com> wrote in message
news:Sj*****************@newsread3.news.pas.earthl ink.net...
magmike wrote:
That's absolutely fantastic! How could I modify it to do the following:

1. add "<a href=" to the front of the link
2. add ">" to the end of the link
3. copy & repaste the link after ">"
4. then add "</a>" after that?

Is that even possible?


Here's a modification to my code. I'll give 2 examples
Ex#1:
? CheckHttp("This is a test of <a href=http://www.microsoft.com></a>,
www.google.com")

This returned the following:
This is a test of <a href=http://www.microsoft.com></a>, <a
href=http://www.google.com></a>

Ex#2
? CheckHttp("This is a test of http://www.microsoft.com, www.google.com")

ANd that returned.
This is a test of <a href=http://www.microsoft.com></a>, <a
href=http://www.google.com></a>

I would do more testing on this...I'm checking for spaces and commas
only. Take a few complicated memos you have and check the results. I
suppose people can goof things up with http://www.x.com> or not putting
"<a " in front of href= etc. As far as I'm concerned, if people don't
start getting creative with their punctuation and inserting their own
stuff into URLs then for the most part it should be OK.

Function CheckHttp(varMemo As Variant) As Variant
Dim ar(5)
Dim i As Integer
Dim intFor As Integer
Dim intPos As Integer
Dim intStart As Integer
Dim strHold As Variant

ar(1) = ".www"
ar(2) = ".com"
ar(3) = ".org"
ar(4) = ".info"
ar(5) = ".biz"

'scan each type
For i = 1 To 5
'where to start searching in the memo
intStart = 1

'do forever
Do While True
'see if string searched for is found
intPos = InStr(intStart, varMemo, ar(i))

'exit forever if not found
If intPos = 0 Then Exit Do

'read backwards to first non-char or beginning of memo
For intFor = intPos To 1 Step -1
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Then
'kick up to first char after space
intFor = intFor + 1
Exit For
End If
Next intFor

If Mid(varMemo, intFor, 7) = "http://" Then
varMemo = Left(varMemo, intFor - 1) & "<a href=" & _
Mid(varMemo, intFor)
ElseIf Mid(varMemo, intFor, 5) <> "href=" Then
varMemo = Left(varMemo, intFor - 1) & "<a
href=http://" & _
Mid(varMemo, intFor)
End If

'now get to the end of the link
For intFor = intPos To Len(varMemo)
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Or Mid(varMemo,
intFor, 1) = "," Then
'kick up to first char after space
intFor = intFor - 1
Exit For
End If
Next intFor

If Right(Left(varMemo, intFor), 5) <> "></a>" Then
varMemo = Left(varMemo, intFor) & "></a>" & _
Mid(varMemo, intFor + 1)
intStart = intFor + 5
Else
intStart = intFor
End If

Loop
Next i

CheckHttp = varMemo
End Function

Nov 13 '05 #8
magmike wrote:
I keep getting this error when I run either function:

Run-time error '94':

Invalid use of Null

The dubugger then points to following line in the code:

intPos = InStr(intStart, varMemo, ar(i))

Any clues?


Not really. Did you change the values of AR()? How about the count? I
guess I'd need to know what the value of "I" is, how many elements you
have in AR(), what intStart is, and if varMemo is null...it shouldn't
but you never know.
Nov 13 '05 #9
In CheckHttp, I have a total of 8 "ar" listing, having added, .net, .gov,
and .edu. In my newly created CheckMailto1, I only have one ar, which is
"@". Both modified functions are included below:

BEGIN CHECKHTTP
-------------------------------------------
Function CheckHttp(varMemo As Variant) As Variant
Dim ar(8)
Dim i As Integer
Dim intFor As Integer
Dim intPos As Integer
Dim intStart As Integer
Dim strHold As Variant

ar(1) = ".www"
ar(2) = ".com"
ar(3) = ".org"
ar(4) = ".info"
ar(5) = ".biz"
ar(6) = ".net"
ar(7) = ".gov"
ar(8) = ".edu"

'scan each type
For i = 1 To 8
'where to start searching in the memo
intStart = 1

'do forever
Do While True
'see if string searched for is found
intPos = InStr(intStart, varMemo, ar(i))

'exit forever if not found
If intPos = 0 Then Exit Do

'read backwards to first non-char or beginning of memo
For intFor = intPos To 1 Step -1
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Then
'kick up to first char after space
intFor = intFor + 1
Exit For
End If
Next intFor

If Mid(varMemo, intFor, 7) = "http://" Then
varMemo = Left(varMemo, intFor - 1) & "<a href=" & _
Mid(varMemo, intFor)
ElseIf Mid(varMemo, intFor, 5) <> "href=" Then
varMemo = Left(varMemo, intFor - 1) & "<a "
href = "http://" & _
Mid(varMemo, intFor)
End If

'now get to the end of the link
For intFor = intPos To Len(varMemo)
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Or Mid(varMemo,
intFor, 1) = "," Then
'kick up to first char after space
intFor = intFor - 1
Exit For
End If
Next intFor

If Right(Left(varMemo, intFor), 5) <> "></a>" Then
varMemo = Left(varMemo, intFor) & "></a>" & _
Mid(varMemo, intFor + 1)
intStart = intFor + 5
Else
intStart = intFor
End If

Loop
Next i

CheckHttp = varMemo
End Function
BEGIN CHECKMAILTO1
--------------------------------------
Function CheckMailto1(varMemo As Variant) As Variant
Dim ar(1)
Dim i As Integer
Dim intFor As Integer
Dim intPos As Integer
Dim intStart As Integer
Dim strHold As Variant

ar(1) = "@"

'scan each type
For i = 1 To 1
'where to start searching in the memo
intStart = 1

'do forever
Do While True
'see if string searched for is found
intPos = InStr(intStart, varMemo, ar(i))

'exit forever if not found
If intPos = 0 Then Exit Do

'read backwards to first non-char or beginning of memo
For intFor = intPos To 1 Step -1
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Then
'kick up to first char after space
intFor = intFor + 1
Exit For
End If
Next intFor

If Mid(varMemo, intFor, 7) = "mailto:" Then
varMemo = Left(varMemo, intFor - 1) & "<a href=" & _
Mid(varMemo, intFor)
ElseIf Mid(varMemo, intFor, 5) <> "href=" Then
varMemo = Left(varMemo, intFor - 1) & "<a "
href = "mailto:" & _
Mid(varMemo, intFor)
End If

'now get to the end of the link
For intFor = intPos To Len(varMemo)
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Or Mid(varMemo,
intFor, 1) = "," Then
'kick up to first char after space
intFor = intFor - 1
Exit For
End If
Next intFor

If Right(Left(varMemo, intFor), 5) <> "></a>" Then
varMemo = Left(varMemo, intFor) & "></a>" & _
Mid(varMemo, intFor + 1)
intStart = intFor + 5
Else
intStart = intFor
End If

Loop
Next i

CheckMailto1 = varMemo
End Function



Nov 13 '05 #10
magmike wrote:
In CheckHttp, I have a total of 8 "ar" listing, having added, .net, .gov,
and .edu. In my newly created CheckMailto1, I only have one ar, which is
"@". Both modified functions are included below:


I see the ar(8) and the 8 elements. I ran the test on a null value and
I get your error.

Prior to the For i = 1 to 8 enter a line like
If not isnull(varMemo) then
and add an EndIf after the line
Next I

There's no need to check memos if they are null.
Nov 13 '05 #11
I was able to get rid of that error. However, there is now another:

Run-time error '5':

Invalid procedure call or argument

which the dubugger then points to this line in CheckMailto1:

If Mid(varMemo, intFor, 7) = "mailto:" Then

and this line in CheckHttp:

If Mid(varMemo, intFor, 7) = "http://" Then

Functions follow for easy reference:

BEGIN CHECKHTTP:
--------------------------------------------
Function CheckHttp(varMemo As Variant) As Variant
Dim ar(8)
Dim i As Integer
Dim intFor As Integer
Dim intPos As Integer
Dim intStart As Integer
Dim strHold As Variant

ar(1) = ".www"
ar(2) = ".com"
ar(3) = ".org"
ar(4) = ".info"
ar(5) = ".biz"
ar(6) = ".net"
ar(7) = ".gov"
ar(8) = ".edu"

If Not IsNull(varMemo) Then
'scan each type
For i = 1 To 8
'where to start searching in the memo
intStart = 1

'do forever
Do While True
'see if string searched for is found
intPos = InStr(intStart, varMemo, ar(i))

'exit forever if not found
If intPos = 0 Then Exit Do

'read backwards to first non-char or beginning of memo
For intFor = intPos To 1 Step -1
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Then
'kick up to first char after space
intFor = intFor + 1
Exit For
End If
Next intFor

If Mid(varMemo, intFor, 7) = "http://" Then
varMemo = Left(varMemo, intFor - 1) & "<a href=" & _
Mid(varMemo, intFor)
ElseIf Mid(varMemo, intFor, 5) <> "href=" Then
varMemo = Left(varMemo, intFor - 1) & "<a "
href = "http://" & _
Mid(varMemo, intFor)
End If

'now get to the end of the link
For intFor = intPos To Len(varMemo)
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Or Mid(varMemo,
intFor, 1) = "," Then
'kick up to first char after space
intFor = intFor - 1
Exit For
End If
Next intFor

If Right(Left(varMemo, intFor), 5) <> "></a>" Then
varMemo = Left(varMemo, intFor) & "></a>" & _
Mid(varMemo, intFor + 1)
intStart = intFor + 5
Else
intStart = intFor
End If

Loop
Next i
End If

CheckHttp = varMemo
End Function
BEGIN CHECKMAILTO1:
-------------------------------------------
Function CheckMailto1(varMemo As Variant) As Variant
Dim ar(1)
Dim i As Integer
Dim intFor As Integer
Dim intPos As Integer
Dim intStart As Integer
Dim strHold As Variant

ar(1) = "@"
If Not IsNull(varMemo) Then
'scan each type
For i = 1 To 1
'where to start searching in the memo
intStart = 1

'do forever
Do While True
'see if string searched for is found
intPos = InStr(intStart, varMemo, ar(i))

'exit forever if not found
If intPos = 0 Then Exit Do

'read backwards to first non-char or beginning of memo
For intFor = intPos To 1 Step -1
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Then
'kick up to first char after space
intFor = intFor + 1
Exit For
End If
Next intFor

If Mid(varMemo, intFor, 7) = "mailto:" Then
varMemo = Left(varMemo, intFor - 1) & "<a href=" & _
Mid(varMemo, intFor)
ElseIf Mid(varMemo, intFor, 5) <> "href=" Then
varMemo = Left(varMemo, intFor - 1) & "<a "
href = "mailto:" & _
Mid(varMemo, intFor)
End If

'now get to the end of the link
For intFor = intPos To Len(varMemo)
'if less/= space, exit for/next
If Mid(varMemo, intFor, 1) <= Chr(32) Or Mid(varMemo,
intFor, 1) = "," Then
'kick up to first char after space
intFor = intFor - 1
Exit For
End If
Next intFor

If Right(Left(varMemo, intFor), 5) <> "></a>" Then
varMemo = Left(varMemo, intFor) & "></a>" & _
Mid(varMemo, intFor + 1)
intStart = intFor + 5
Else
intStart = intFor
End If

Loop
Next i
End If
CheckMailto1 = varMemo
End Function


Nov 13 '05 #12
magmike wrote:
I was able to get rid of that error. However, there is now another:

Run-time error '5':

Invalid procedure call or argument

which the dubugger then points to this line in CheckMailto1:

If Mid(varMemo, intFor, 7) = "mailto:" Then

and this line in CheckHttp:

If Mid(varMemo, intFor, 7) = "http://" Then


It's hard to say what the problem is. What is the value of intFor?
What is the length of varMemo? I don't know what the value of varMemo
is. Is it possible intFor is greater than the length of the memo?
Perhaps there is a entry like www.common.com where .com is seen before
expected. Ain't debugging fun?
Nov 13 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Remco Groot Beumer | last post by:
Hello, In an Access 97 database, there is a table that has some Memo-fields. Some of the memo-fields (not all) with a lot of text in it, display the data blurred all over each other (two...
13
by: ken | last post by:
I have 5 memo fields in one of my tables. I need to add 7 more. Will this be a problem? Am I being paranoid? Thanks
4
by: Haydnw | last post by:
Hi, I'd like to put a load of database results (several rows for 5 fields) into a two-dimensional array. Now, this may be a really stupid question, but can someone give me a pointer for how to...
2
by: jacoballen | last post by:
I have a query that combines the results of three related tables. The memo fields are truncated to 255 characters, but I need all the information in them. I'm aware that removing code such as...
1
by: Ariharan | last post by:
I have created a Database using MSacces in VisualData Manager of Visual Basic.The table contains 6 memo fields and 2 text fields. The problem is now i cannot use this table in VB Coding. Consider...
10
by: ARC | last post by:
This is mainly a speed question. In this example: I have a QuotesHdr table that has a few memo fields. If these memo fields are used extensively by some users, and if their are a large number of...
11
by: christianlott1 | last post by:
I really think it's a shame ms access has such a buggy memo field :( A database that can't store even a paragraph of contiguous text in 2008. M$ rocks!
2
by: steph | last post by:
I have a table with 250 fields. Of course you are wondering why 250 fields... what could I possibly be storing in so many fields? I am using this table as a general import table for files that...
4
by: Wayne | last post by:
I've been asked to construct a database which will require several memo fields. This database will be the standard frontend/backend mdb configuration. I have read many posts describing the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.