Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use Access to open Internet Explorer 1

Status
Not open for further replies.

ruthcali

Programmer
Apr 27, 2000
470
US
I am using Access97.

In my Access form, i am trying to write code to open an intranet website and go to a specific record in the website.
(The intranet website requires a password.)

I got this to work:
Dim stAppName As String
stAppName = “C:\Program Files\Internet Explorer\IEXPLORE.EXE & Me.id_no
Call Shell(stAppName, 1)

The intranet website opens and asks for the password. After the user enters the password, the website opens to the proper record.

Great.

But, if the user goes back to a different record in the Access database and tries to go to the intranet website again, Explorer launchs a new instance and again requests the users' password.

Is there a way to not have Internet Explorer launch a new instance everytime the code is run?
Thanks,
Ruth
 
From your code I can see that you start an explorer every time with the: Call Shell(stAppName, 1), this is why you get the password problem, you must check if explorer is open and if not call it.

This code does not open a new instance of explorer if its open, maybe you can use some of it?
Sub Dim intRtn As Integer
Dim strURL As String, SearchString As String
strURL = "
SearchString = SearchTxt
strURL = strURL & SearchString
intRtn = Shell("rundll32.exe url.dll,FileProtocolHandler" & strURL)
End Sub
Herman
 
Herman,
Thanks! it works.

(I just had to change 'Dim intRtn As Integer' to
'Dim intRtn' because i was getting an overflow error).

For another way to do this, I was thinking, in my form's design view, could i also do 'Insert' 'Hyperlink' and type something like:
& Me.id_no in the hyperlink address field?

I tried and it wasn't working, but is that because my syntax above is wrong or because it's not possible to add code to a hyperlink?

I was ultimately trying to change the mouse cursor into a hand when the user clicks on the text box to open the intranet site.

Thanks!
 
Hi Ruth
Good stuff. A star for me ? ;-)
I do not think that you can make a hyperlink like the above as you will not get the me!id_no into the link (note the ! not . in me!)
Note that dot "." refers to internal access and bang "!" refers to your own controls.

However you could change the controls hyperlink on the forms on current event into doing exactly what you want.
I have never worked with the mouse cursors so I am not sure here but you could try something on the MouseOver event on this control, how to control the mouse cursor, well .....

Herman
 
Herman,
of course you deserve a star. sorry for not doing it sooner. :)

2 questions: (. vs !)
--If Auto List Members is turned on, (tools, options, module) when i am in the code module and start to type 'me.' Access automatically displays, among other things, a list of all my field names. So i only have to start to type 'me.id_' and Access automatically fills in the rest of the field name. (me.id_no)

But, are you saying that i should use the ! when referring to my own fields and not the .? But then why would Access display my fields when i type me.?

Shouldn't Access display only internal Access functions when i type . and display my own controls when i type ! ?

2nd question: (MouseOver)
--Where is the MouseOver event? i see MouseDown and MouseMove and MouseUp, but no MouseOver. I am using Access97. Maybe this is something not found in my version?

PS-i found a MousePointer property, but there is no Hand. oh well.

Thanks again!
 
1. Yes I have seen this too .... been tempted YES done it NO ;-) does not work. The controls are there as they are now a part of access and you can refer to ther properties.
2. I am sure that I have seen a mouse over event..... Grrrrr I cant find it now, but there is a mouse move that should do the trick for you, I use A2K but I am sure that this event is also in A97.

I will have a look for the mouse over event,..... mybe I remenber it from VB6..... not sure could be.... sorry.
Let me know how it works out 4 U.
Herman
 
Herman,

thanks again. i made the text box blue and underlined so i think my users will know it's a hyperlink, even though the mouse won't become a hand.

I added the code to the OnClick Event of the text box and the code works perfectly. it only opens one instance of Explorer which is exactly what i wanted.

I think MouseOver might be a Visual Basic thing. oh well.

Thanks again for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top