access to web page

G

Guest

I need to pass the variant(value1) in my database to a web page. I use the
following code to do that:
Application.FollowHyperlink "URL.do?" & "variable1=" & value1

When I open the specific web page and type in the value1 my self, I will get
URL.do?variable1=value1
in the address window and get the info that I need from that site. But when
I apply the code, I will open IE to the same site with exactly the same
"URL.do?variable1=value1" in the address window, but I will get the following
error message:
java.lang.Exception: java.lang.StringIndexOutOfBoundsException: String
index out of range: 3

Any idea what happened? Thanks a lot.

B.Rgds
Gordon
 
G

Guest

Does value1 contain a 'blank'? If so this may well cause the problem. Try
replacing blanks with '%20'.

Good luck.

BW
 
B

Brendan Reynolds

Perhaps you need quotes around the value?

Application.FollowHyperlink "URL.do?" & "variable1='" & value1 & "'"

That's a single quote followed by a double quote after the "=" and a single
quote between two double quotes at the end.

You say the variable is a variant, so don't forget to check for null ...

If Not IsNull(value1) Then
FollowHyperlink etc
Else
'whatever is appropriate when value is null
End If
 
G

Guest

Alex,

I tried that code and got the same result. The problem is, even I copied
http://URL.do?variable1=value1 directly to the IE address window, I will
get the error message. I am wondering if I have to go to their home page
to get the info or someway to go around with it. Thanks a lot.

B.Rgds
Gordon
 
G

Guest

Lets try again!

I've tested your syntax and it works on my PC/web site. The only time it
doesn't is if the http:// is missing from the URL.

Your code should read:

Application.FollowHyperlink "http://URL.do?" & "variable1=" & value1

Good luck again!

BW
 
G

Guest

BeWyched,

This is not the case because I have the "http://" in the URL. Thanks.

B.Rgds
Gordon
 

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

Top