OnClick Event

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

Guest

What part of this code do I need to change to get this to work?

Onclick event, when clicked, it should take the value in PHONE field and
paste it into XXXX:

https://secure.domain.com/details.asp?account=XXXXX
Becomes:
https://secure.domain.com/details.asp?account=2547290000

The kicker - PHONE field's data is stored in this format, have an input mask
for the field in the table: !\(999") "000\-0000;0;_ WHICH = (254) 729-000

======= CODE ============

astrTokens = Split([Phone], ".")
i = UBound(astrTokens)

Strwww = "https://secure.domain.com/details.asp?account=" & _
astrTokens(i - 1) & "." & astrTokens(i)

Application.FollowHyperlink Strwww

======= CODE ============

Thanks!!!
Curtis
 
If I'm not mistaken, the input mask has no bearing on how a string is stored
in the database. Have you actually tried your code, and if so, what is it
doing? And what is the purpose of the call to Split? There don't seem to be
any periods in your phone numbers.

Carl Rapson
 
I have this code.

====
Dim astrTokens() As String
Dim i As Integer
Dim Strwww

astrTokens = Split([Phone], ".")
i = UBound(astrTokens)

Strwww = "http://www.blahblah.com/" & _
astrTokens(i - 1) & "." & astrTokens(i)

Application.FollowHyperlink Strwww
===

It is pointing to these two lines saying Subscript out of range?

Strwww = "http://www.blahblah.com/" & _
astrTokens(i - 1) & "." & astrTokens(i)




If I'm not mistaken, the input mask has no bearing on how a string is stored
in the database. Have you actually tried your code, and if so, what is it
doing? And what is the purpose of the call to Split? There don't seem to be
any periods in your phone numbers.

Carl Rapson

Curtis Stevens said:
What part of this code do I need to change to get this to work?

Onclick event, when clicked, it should take the value in PHONE field and
paste it into XXXX:

https://secure.domain.com/details.asp?account=XXXXX
Becomes:
https://secure.domain.com/details.asp?account=2547290000

The kicker - PHONE field's data is stored in this format, have an input
mask
for the field in the table: !\(999") "000\-0000;0;_ WHICH = (254)
729-000

======= CODE ============

astrTokens = Split([Phone], ".")
i = UBound(astrTokens)

Strwww = "https://secure.domain.com/details.asp?account=" & _
astrTokens(i - 1) & "." & astrTokens(i)

Application.FollowHyperlink Strwww

======= CODE ============

Thanks!!!
Curtis
 
That's because there is nothing to Split on, since there are no periods in
your string. You need to check the value of i after you set it with the
UBound call. It's probably zero, which would result in the error you're
seeing.

Carl Rapson

Curtis Stevens said:
I have this code.

====
Dim astrTokens() As String
Dim i As Integer
Dim Strwww

astrTokens = Split([Phone], ".")
i = UBound(astrTokens)

Strwww = "http://www.blahblah.com/" & _
astrTokens(i - 1) & "." & astrTokens(i)

Application.FollowHyperlink Strwww
===

It is pointing to these two lines saying Subscript out of range?

Strwww = "http://www.blahblah.com/" & _
astrTokens(i - 1) & "." & astrTokens(i)




If I'm not mistaken, the input mask has no bearing on how a string is
stored
in the database. Have you actually tried your code, and if so, what is it
doing? And what is the purpose of the call to Split? There don't seem to
be
any periods in your phone numbers.

Carl Rapson

message
What part of this code do I need to change to get this to work?

Onclick event, when clicked, it should take the value in PHONE field
and
paste it into XXXX:

https://secure.domain.com/details.asp?account=XXXXX
Becomes:
https://secure.domain.com/details.asp?account=2547290000

The kicker - PHONE field's data is stored in this format, have an input
mask
for the field in the table: !\(999") "000\-0000;0;_ WHICH = (254)
729-000

======= CODE ============

astrTokens = Split([Phone], ".")
i = UBound(astrTokens)

Strwww = "https://secure.domain.com/details.asp?account=" & _
astrTokens(i - 1) & "." & astrTokens(i)

Application.FollowHyperlink Strwww

======= CODE ============

Thanks!!!
Curtis
 
Back
Top