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
Alex Dybenko - 15 Nov 2006 12:09 GMT
Hi,
try to use ShellExecute function:
http://maug.pointltd.com/access/Queries/TipDetail.asp?TipID=5
like:
call apiShellExecute(GetDesktopWindow(), "open", "http://URL.do?" &
"variable1=" & value1", "", 0&, SW_SHOWMAXIMIZED)

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
>I need to pass the variant(value1) in my database to a web page. I use the
> following code to do that:
[quoted text clipped - 16 lines]
> B.Rgds
> Gordon
Gordon - 15 Nov 2006 14:40 GMT
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
> Hi,
> try to use ShellExecute function:
[quoted text clipped - 25 lines]
> > B.Rgds
> > Gordon
BeWyched - 15 Nov 2006 13:04 GMT
Does value1 contain a 'blank'? If so this may well cause the problem. Try
replacing blanks with '%20'.
Good luck.
BW
> I need to pass the variant(value1) in my database to a web page. I use the
> following code to do that:
[quoted text clipped - 13 lines]
> B.Rgds
> Gordon
Gordon - 15 Nov 2006 15:21 GMT
BeWyched,
There won't be any 'blank' in the value1. Thanks.
B.Rgds
Gordon
> Does value1 contain a 'blank'? If so this may well cause the problem. Try
> replacing blanks with '%20'.
[quoted text clipped - 20 lines]
> > B.Rgds
> > Gordon
BeWyched - 15 Nov 2006 17:28 GMT
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
> BeWyched,
>
[quoted text clipped - 27 lines]
> > > B.Rgds
> > > Gordon
Gordon - 16 Nov 2006 06:55 GMT
BeWyched,
This is not the case because I have the "http://" in the URL. Thanks.
B.Rgds
Gordon
> Lets try again!
>
[quoted text clipped - 40 lines]
> > > > B.Rgds
> > > > Gordon
Brendan Reynolds - 15 Nov 2006 13:06 GMT
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

Signature
Brendan Reynolds
Access MVP
>I need to pass the variant(value1) in my database to a web page. I use the
> following code to do that:
[quoted text clipped - 16 lines]
> B.Rgds
> Gordon
Gordon - 15 Nov 2006 14:44 GMT
Brendan,
With your syntax, I will get:
http://URL.do?variable1='value1'
But it did not work either. Thanks.
B.Rgds
Gordon
> Perhaps you need quotes around the value?
>
[quoted text clipped - 31 lines]
> > B.Rgds
> > Gordon