Internet Explorer Browser

  • Thread starter Thread starter raineel via AccessMonster.com
  • Start date Start date
R

raineel via AccessMonster.com

i have a form in access. one of it label is linked to a a site containing
information about clients. when i run the form and click on the label the
info opens up in an IE browser. when i click the label again it opens another
info in a new IE browser is there a way i can keep clicking my label as many
times as i want to get the info but in the same browser page not multiple
pages. i need the old info replaced by the new info in the same page

below is the code i am using.

Dim objBrowser As InternetExplorer
Set objBrowser = New InternetExplorer


objBrowser.Visible = True
objBrowser.Navigate2 ("my url")
Set objBrowser = Nothing
Exit Sub
End Sub


Any help is appreciated

thanks

raineel
 
Each time you have Set objBrowser = New InternetExplorer, you're going to
get a new browser opening up (and each you have Set objBrowser = Nothing,
it's going to close)

See what happens if you replace the instantiation of the object (the "Set
objBrowser = New InternetExplorer" statement) with the following, so that it
only instantiates the object if it hasn't already been instantiated:

If objBrowser Is Nothing Then
Set objBrowser = New InternetExplorer
End If

Leave out the Set objBrowser = Nothing until the form's Close event.
 
i replaced the code with the code below it still opens multiple windows
everytime i click my label.

Thank You,

Raineel
Each time you have Set objBrowser = New InternetExplorer, you're going to
get a new browser opening up (and each you have Set objBrowser = Nothing,
it's going to close)

See what happens if you replace the instantiation of the object (the "Set
objBrowser = New InternetExplorer" statement) with the following, so that it
only instantiates the object if it hasn't already been instantiated:

If objBrowser Is Nothing Then
Set objBrowser = New InternetExplorer
End If

Leave out the Set objBrowser = Nothing until the form's Close event.
i have a form in access. one of it label is linked to a a site containing
information about clients. when i run the form and click on the label the
[quoted text clipped - 21 lines]
 
My mistake. I forgot to mention either change

Dim objBrowser As InternetExplorer

to

Static objBrowser As InternetExplorer

or else move the declaration to outside of the sub (i.e.: to the very top of
the module, before any subs or functions are declared)

Sorry about that.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



raineel via AccessMonster.com said:
i replaced the code with the code below it still opens multiple windows
everytime i click my label.

Thank You,

Raineel
Each time you have Set objBrowser = New InternetExplorer, you're going to
get a new browser opening up (and each you have Set objBrowser = Nothing,
it's going to close)

See what happens if you replace the instantiation of the object (the "Set
objBrowser = New InternetExplorer" statement) with the following, so that
it
only instantiates the object if it hasn't already been instantiated:

If objBrowser Is Nothing Then
Set objBrowser = New InternetExplorer
End If

Leave out the Set objBrowser = Nothing until the form's Close event.
i have a form in access. one of it label is linked to a a site containing
information about clients. when i run the form and click on the label
the
[quoted text clipped - 21 lines]
 
HI

this is what i wrote on the onclick event of my label

Static objBrowser As InternetExplorer
If objBrowser Is Nothing Then
Set objBrowser = New InternetExplorer
End If

objBrowser.Visible = True
objBrowser.Navigate ("my url")
exit sub
end sub

when i run this code it does open in just one browser no matter how many
times i click the label which is great. when i exit the browser completely
and then click on the label again it gives me error saying

run-time error 462 = the remote server machine does not exist or is
unavailable. and then when i go back to see where the error is it highlights
objBrowser. visible = True

i am not sure if i am missing something

thank you for all your help

Best Regards,

raineel
My mistake. I forgot to mention either change

Dim objBrowser As InternetExplorer

to

Static objBrowser As InternetExplorer

or else move the declaration to outside of the sub (i.e.: to the very top of
the module, before any subs or functions are declared)

Sorry about that.
i replaced the code with the code below it still opens multiple windows
everytime i click my label.
[quoted text clipped - 24 lines]
 
hi

Now i am also getting another error in addition to the error in my earlier
post

Automation error: the object invoked has disconnected from its clients.

thank you for all your help

Best Regards,

Raineel
HI

this is what i wrote on the onclick event of my label

Static objBrowser As InternetExplorer
If objBrowser Is Nothing Then
Set objBrowser = New InternetExplorer
End If

objBrowser.Visible = True
objBrowser.Navigate ("my url")
exit sub
end sub

when i run this code it does open in just one browser no matter how many
times i click the label which is great. when i exit the browser completely
and then click on the label again it gives me error saying

run-time error 462 = the remote server machine does not exist or is
unavailable. and then when i go back to see where the error is it highlights
objBrowser. visible = True

i am not sure if i am missing something

thank you for all your help

Best Regards,

raineel
My mistake. I forgot to mention either change
[quoted text clipped - 14 lines]
 
Switch to declaring objBrowser outside of the sub, and putting Set
objBrowser = Nothing in the form's Close event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



raineel via AccessMonster.com said:
HI

this is what i wrote on the onclick event of my label

Static objBrowser As InternetExplorer
If objBrowser Is Nothing Then
Set objBrowser = New InternetExplorer
End If

objBrowser.Visible = True
objBrowser.Navigate ("my url")
exit sub
end sub

when i run this code it does open in just one browser no matter how many
times i click the label which is great. when i exit the browser completely
and then click on the label again it gives me error saying

run-time error 462 = the remote server machine does not exist or is
unavailable. and then when i go back to see where the error is it
highlights
objBrowser. visible = True

i am not sure if i am missing something

thank you for all your help

Best Regards,

raineel
My mistake. I forgot to mention either change

Dim objBrowser As InternetExplorer

to

Static objBrowser As InternetExplorer

or else move the declaration to outside of the sub (i.e.: to the very top
of
the module, before any subs or functions are declared)

Sorry about that.
i replaced the code with the code below it still opens multiple windows
everytime i click my label.
[quoted text clipped - 24 lines]
 
getting same error. declared the dim objBrowser as Internetexplorer in
general declarations and the Set objBrowser = Nothing in the forms closing
event. and the other code in the click event of the label.

Thankx

Best Regards,

Raineel

Switch to declaring objBrowser outside of the sub, and putting Set
objBrowser = Nothing in the form's Close event.
[quoted text clipped - 46 lines]
 
Sorry, I'm out of ideas. Try pasting all of the relevant code into a new
thread, in the hopes that someone else will take a look at it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



raineel via AccessMonster.com said:
getting same error. declared the dim objBrowser as Internetexplorer in
general declarations and the Set objBrowser = Nothing in the forms
closing
event. and the other code in the click event of the label.

Thankx

Best Regards,

Raineel

Switch to declaring objBrowser outside of the sub, and putting Set
objBrowser = Nothing in the form's Close event.
[quoted text clipped - 46 lines]
 
hi,
when i run this code it does open in just one browser no matter how many
times i click the label which is great. when i exit the browser completely
and then click on the label again it gives me error saying

run-time error 462 = the remote server machine does not exist or is
unavailable. and then when i go back to see where the error is it highlights
objBrowser. visible = True

The following form works fine with A2003/WXP/IE6.0sp2:

Option Compare Database
Option Explicit

Private m_IE As InternetExplorer

Private Sub cmdNavigate_Click()

On Local Error GoTo LocalError

If m_IE Is Nothing Then
Set m_IE = New InternetExplorer
m_IE.Visible = True
End If

m_IE.Navigate txtURL.Value

Exit Sub

LocalError:
If Err.Number = 462 Or _
Err.Number = &H80010108 Then
Set m_IE = New InternetExplorer
m_IE.Visible = True
Resume
Else
MsgBox "Need more error handling."
End If

End Sub


mfG
--> stefan <--
 
Thanks a bunch, it worked

Regards,

Raineel

Stefan said:
hi,
when i run this code it does open in just one browser no matter how many
times i click the label which is great. when i exit the browser completely
[quoted text clipped - 3 lines]
unavailable. and then when i go back to see where the error is it highlights
objBrowser. visible = True

The following form works fine with A2003/WXP/IE6.0sp2:

Option Compare Database
Option Explicit

Private m_IE As InternetExplorer

Private Sub cmdNavigate_Click()

On Local Error GoTo LocalError

If m_IE Is Nothing Then
Set m_IE = New InternetExplorer
m_IE.Visible = True
End If

m_IE.Navigate txtURL.Value

Exit Sub

LocalError:
If Err.Number = 462 Or _
Err.Number = &H80010108 Then
Set m_IE = New InternetExplorer
m_IE.Visible = True
Resume
Else
MsgBox "Need more error handling."
End If

End Sub

mfG
--> stefan <--
 
Back
Top