Hi Everbody
I am trying to trap the error that SHOULD occur when there is no
internet connection.
Private Sub CmdPayHere_Clic k()
On Error GoTo Err_CmdPayHere_ Click
Application.Fol lowHyperlink "http://www.microsoft.c om"
Err_CmdPayHere_ Click:
MsgBox "Page Not Available, Check that You ARE online",
vbInformation, "No Internet Connection"
End Sub
However, the above code displays the error message whether there is a
connection or not
Also, when there is NO CONNECTION, there is no error displayed at all.
All that happens is the browser does not display.
Thanks in advance for any help.
Bob 5 3511
> I am trying to trap the error that SHOULD occur when there is no internet connection.
However, the above code displays the error message whether there is a connection or not
See my inline VBA comments below:
Private Sub CmdPayHere_Clic k()
On Error GoTo Err_CmdPayHere_ Click
Application.Fol lowHyperlink "http://www.microsoft.c om"
' In normal operation, you must exit the sub before your
' error handler. Otherwise execution passes straight through
' and runs the code in your Error handler block.
Exit_CmdPayHere _Click:
Exit Sub
Err_CmdPayHere_ Click:
MsgBox "Page Not Available, Check that You ARE online",
vbInformation, "No Internet Connection"
' I also like to do this. This way, my procedure has exactly
' one exit point and exactly one entry point. But some folks
' hate Goto's more than me:
Goto Exit_CmdPayHere _Click
End Sub
--
Peace & happy computing,
Mike Labosh, MCSD
"When you kill a man, you're a murderer.
Kill many, and you're a conqueror.
Kill them all and you're a god." -- Dave Mustane
"bobdydd" <re************ **@yahoo.co.uk> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. . Hi Everbody
I am trying to trap the error that SHOULD occur when there is no internet connection.
Private Sub CmdPayHere_Clic k() On Error GoTo Err_CmdPayHere_ Click Application.Fol lowHyperlink "http://www.microsoft.c om" Err_CmdPayHere_ Click: MsgBox "Page Not Available, Check that You ARE online", vbInformation, "No Internet Connection" End Sub
However, the above code displays the error message whether there is a connection or not
Also, when there is NO CONNECTION, there is no error displayed at all. All that happens is the browser does not display.
Thanks in advance for any help.
Bob
THanks Mike. That did the trick.
"Mike Labosh" <ml*****@hotmai l.com> wrote in message
news:%2******** *******@TK2MSFT NGP09.phx.gbl.. . ' In normal operation, you must exit the sub before your ' error handler. Otherwise execution passes straight through ' and runs the code in your Error handler block. Exit_CmdPayHere _Click: Exit Sub
Err_CmdPayHere_ Click: MsgBox "Page Not Available, Check that You ARE online", vbInformation, "No Internet Connection"
' I also like to do this. This way, my procedure has exactly ' one exit point and exactly one entry point. But some folks ' hate Goto's more than me: Goto Exit_CmdPayHere _Click
Mike: Try using Resume Exit_CmdPayHere _Click. It ensures that the
application realizes that the error has been handled.
Good advice, btw.
--
Doug Steele, Microsoft Access MVP http://I.Am/DougSteele
(no e-mails, please!)
> Mike: Try using Resume Exit_CmdPayHere _Click. It ensures that the application realizes that the error has been handled.
[slapping forehead] OOPS! Yes, because Resume also clears the error
condition. Can you tell it's been a while since I used VBA?
--
Peace & happy computing,
Mike Labosh, MCSD
"When you kill a man, you're a murderer.
Kill many, and you're a conqueror.
Kill them all and you're a god." -- Dave Mustane
Thanks Doug
I will alter it to that.
Bob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Krechting |
last post by:
Hi All,
I have two hyperlinkfields in my database. Both fields have to point to
different folders. One is called "IN" and the other "OUT".
Access can have only one hperlinkbase. That's why I added some code for
the click event, namely:
Private Sub link_Click()
Dim str As String
If Not IsNull(Me.link) Then
|
by: Marco Krechting |
last post by:
Hi All,
This is a response on my earlier posting about trapping the standard
access error message when you click on a hyperlink field and the file
cannot be found. I know now how to work on the field to use multiple
hyperlink bases
but I still need a way to get rit of this error message.
Can I have a error trap at form level? Or is there another way of
dealing with it?
|
by: Martin Dew |
last post by:
Having some problems getting a hyperlink object to work in my repeater
control, It displays the text I have asked it to for the hyperlink, but it
does not act as a link. My repeater code is below but here is the snippet of
my asp:hyperlink object;
<asp:HyperLink
NavigateUrl="authonly/clientdetails.aspx?searchID="+<%#DataBinder.Eval(Conta
iner.DataItem,"CLIENTREF")%>
ID="Hyperlink1"><%#DataBinder.Eval(Container.DataItem,...
|
by: marc-andr? |
last post by:
Hi,
I have to loop on each control on a webforms...
I use this function :
public void LoopOnAllControls(ControlCollection coll)
{
foreach (System.Web.UI.Control ctrl in coll)
{
|
by: AlastairHardwick |
last post by:
Hi,
Wonder if you can help? I have an Image Management Database which holds various information relating to Ghost Images and Testing.
I am using a textbox with a hyperlink to display the path to a PDF file within a networked filesystem.
To open the PDF I have used the Application.FollowHyperLink(PDFPath) property to enable users to view a PDF by clicking on a "View" command Button.
I need to be able to trap the error if some dumb...
| |
by: keithb |
last post by:
Using a GridView, I get a "Specified cast is not valid" error when binding
the Visible propery of a hyperlink control to a DataTable text field. The
error goes away if I replace the data binding statement with "true" or
"false". This code causes the error:
<asp:HyperLink ID="HyperLink1"
runat="server"
NavigateUrl='<%#
Eval("c2Hyperlink1Link") %>'
Target="_blank"
|
by: =?Utf-8?B?SlA=?= |
last post by:
I have the html code below in a GridView. There are times this binding
statement will fail b/c the column is not in this results set. How do I trap
this? setting the column to Visible = false only solves the problem IF its a
databound column. This MUST be a template column as I need to manipulate
items. I cant just remove the column from the grid, as its viewstate needs to
be maintained even when re-databinding. If I do remove column, then...
|
by: vspsdca |
last post by:
Hi,
I'm a newbie here and does not really have any formal training on VBA. I just need help to get my hyperlink to work. I have a form in MS Access with a browse button where a user can select a folder from a specified directory from our network. I was able to get the browse button working where it saves a path that is selected onto the textbox that is set as hyperlink. The problem appears when you click on the hyperlink... it will work a few...
|
by: NeoPa |
last post by:
Error 7980: The HyperlinkAddress or HyperlinkSubAddress property is read-only for this hyperlink
I'm struggling with some code to update Hyperlinks in my table. The field is defined as a Hyperlink and is editable without problem from the interface (I open the table for display, right-click on an item and select Hyperlink / Edit Hyperlink and all is fine).
The table is defined very simply as :
Table = tblLink
Field Type Index...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |