这似乎有效。也就是说如果我拔掉网线(这是我能想到的重复测试的唯一方法),它就会返回false。 后约25秒。我想做那个瞬间。怎么样? 好的,找到了答案。似乎是OLE / DDE设置。但那是否有一个 的最佳设置?默认值为30秒。事实上,如果 磁盘/网络错误是由一个稍微断断续续的网络造成的,那么它会更好吗_更长_? 或者有人有ping的VBA版本吗? 干杯,Mike MacSweenSome of my users are getting ''Disk or Network Errors''. I''ve raised it withthe network admins, they''re looking into it.In the meantime...My ''standard'' error handlers logs errors to a table in the shared backend.Nice. Unless the error is cause by the above. The error handler in thelogging procedure doesn''t attempt to log errors there, as the most likelycause of an error in the logging procedure is loss of connectivity. But thisstill seems to be a show stopper.So somewhere in this I''d like to test whether connectivity has been lost.I''m trying this:Public Function CheckLinks() As Boolean'' Returns True if links are OK.Dim rst As DAO.RecordsetOn Error Resume NextSet rst = CurrentDb().OpenRecordset("zstLogErr")CheckLinks = (Err.Number = 0) ''If no error, return True.rst.CloseEnd FunctionWhich seems to work. That is to say if I unplug the network cable (which isthe only way I can think of duplicating the test) it returns false. Afterabout 25 seconds. I''d like to make that instant. How to?OK, found the answer. Seems to be the OLE/DDE setting. But is there anoptimum setting for that? The default is 30 seconds. In fact, if thedisk/network error is caused by a slightly intermittent network, would it bebetter to make that a lot _longer_?Or has anybody got a VBA version of ping?Cheers, Mike MacSween推荐答案 2005年9月14日星期三08:33:31 +0100,Mike MacSween < mi ***************** *@btinternet.com>写道: 每次测试都是如此蛮力。 假设你的应用程序配备了错误处理程序,并且 a中央错误处理功能,在该功能中你可以检查 某些错误值,这些错误值会表示后端丢失。 顺便说一句,如果你有间歇性的网络丢失,那么你很可能会有后端腐败等待发生(我假设是MDB后端)。 随着Win2000及以上,你可以在任务栏中显示网络图标, ,它会在重新连接时弹出一个气球。如果用户正在报告那个,那么现在是时候让硬件人员仔细看看了。 -Tom。On Wed, 14 Sep 2005 08:33:31 +0100, "Mike MacSween"<mi******************@btinternet.com> wrote:Testing every time seems so brute-force.Assuming you have outfit your app with error handlers throughout, anda central error handling function, in that function you can check forcertain error values that would indicate loss of back-end.Btw, if you have intermittent loss of network, then you will likelyhave backend corruption waiting to happen (I''m assuming MDB backend).With Win2000 and up, you can display the network icon in the taskbar,and it will popup a balloon when it reconnects. If users are reportingthat, it''s time to have the hardware guys take a serious look at that.-Tom.我的一些用户正在收到磁盘或网络错误。我已经用网络管理员提出了它,他们正在调查它。 同时... 我的'标准' '错误处理程序将错误记录到共享后端的表中。很好。除非错误是由上述原因造成的。 日志记录过程中的错误处理程序不会尝试在那里记录错误,因为记录过程中最可能导致错误的原因是连接丢失。但是这个似乎仍然是一个显示阻止。 所以在这个地方,我想测试连接是否已经丢失。我正在尝试这个: 公共函数CheckLinks()As Boolean ''如果链接正常则返回True。 Dim rst作为DAO.Recordset On Error Resume Next 设置rst = CurrentDb()。OpenRecordset(" zstLogErr") CheckLinks =(Err.Number = 0)''如果没有错误,返回True。 rst.Close 结束函数 这似乎有效。也就是说,如果我拔下网线(这是我能想到重复测试的唯一方法),它会返回false。 约25秒后。我想做那个瞬间。怎么样?好的,找到了答案。似乎是OLE / DDE设置。但是有最佳设置吗?默认值为30秒。事实上,如果磁盘/网络错误是由一个稍微断断续续的网络造成的,那么它会更好吗_更长_ 或者有人得到VBA版本的ping? 干杯,Mike MacSweenSome of my users are getting ''Disk or Network Errors''. I''ve raised it withthe network admins, they''re looking into it.In the meantime...My ''standard'' error handlers logs errors to a table in the shared backend.Nice. Unless the error is cause by the above. The error handler in thelogging procedure doesn''t attempt to log errors there, as the most likelycause of an error in the logging procedure is loss of connectivity. But thisstill seems to be a show stopper.So somewhere in this I''d like to test whether connectivity has been lost.I''m trying this:Public Function CheckLinks() As Boolean '' Returns True if links are OK. Dim rst As DAO.Recordset On Error Resume Next Set rst = CurrentDb().OpenRecordset("zstLogErr") CheckLinks = (Err.Number = 0) ''If no error, return True. rst.CloseEnd FunctionWhich seems to work. That is to say if I unplug the network cable (which isthe only way I can think of duplicating the test) it returns false. Afterabout 25 seconds. I''d like to make that instant. How to?OK, found the answer. Seems to be the OLE/DDE setting. But is there anoptimum setting for that? The default is 30 seconds. In fact, if thedisk/network error is caused by a slightly intermittent network, would it bebetter to make that a lot _longer_?Or has anybody got a VBA version of ping?Cheers, Mike MacSween" Tom van Stiphout" <无************* @ cox.net>在消息中写道 news:c8 ******************************** @ 4ax.com ..."Tom van Stiphout" <no*************@cox.net> wrote in messagenews:c8********************************@4ax.com... 2005年9月14日星期三08:33:31 +0100,Mike MacSween< mi ************* *****@btinternet.com>写道: 每次测试都显得如此蛮力。 是的,我只是把它放在中央错误处理程序中。实际上在试图写入错误日志的 函数中。 假设你的应用程序中装有错误处理程序,并且中央错误处理函数,在该函数中,您可以检查某些错误值,这些错误值将指示后端丢失。 尝试使用上面的代码,这真的减慢了速度,因为Access 似乎在连接到后端。 我想我只会测试3043,磁盘或网络错误,并且在这种情况下确实会有一些不同的东西。 顺便说一句,如果你有间歇性的网络丢失,那么你可能会有后端腐败等待发生(我假设是MDB后端)。 我们已经有了这么多,MDB看起来很好。是否有任何类型的测试 初期腐败? 使用Win2000及以上版本,您可以在任务栏中显示网络图标,它会弹出一个当它重新连接时气球。 On Wed, 14 Sep 2005 08:33:31 +0100, "Mike MacSween" <mi******************@btinternet.com> wrote: Testing every time seems so brute-force.Yes, I''m just putting this in the central error handler. In fact in thefunction that attempts to write to the error log. Assuming you have outfit your app with error handlers throughout, and a central error handling function, in that function you can check for certain error values that would indicate loss of back-end.Tried it with the above code, which really slows things down, as Accessseems to have a ''really good go'' at connecting to the back end.I think I''ll just test for 3043, Disk or Network error, and in that case dosomething different. Btw, if you have intermittent loss of network, then you will likely have backend corruption waiting to happen (I''m assuming MDB backend).We''ve had this quite a lot and the MDB seems fine. Is there any sort of testfor incipient corruption? With Win2000 and up, you can display the network icon in the taskbar, and it will popup a balloon when it reconnects. 我不认为这种连接丢失了。更为暂时。我们 怀疑是一个狡猾的转换(主要原因是'过去几周内唯一没有被b $ b替换的东西)。 干杯,MikeI don''t think it''s that sort of loss of connection. More very temporary. Wesuspect a dodgy switch (mainly cause that''s about the only thing that hasn''tbeen replaced over the last few weeks).Cheers, Mike有关错误处理程序的FWIW,我最近添加了一项新功能。 几个月前,我写了一篇愚蠢的文章,内容是关于如何从Access应用程序,通过防火墙向异地数据库传递少量数据b $ b。 http://www.databasejournal.com/featu ... le.php / 3491216 之后,我想出了让我的客户端mdbs在本地记录错误 的想法,通过插入 数据的ASP页面将副本发送到我的服务器。你可以在这个网站看到它 http://www.amazecreations.com/Client...ort=1&filter=2 我只需添加此功能,从我的错误处理程序中调用它。所以,即使 用户的网络服务器不可用,我仍然可以看到该消息,只要他们的互联网连接不会发生故障。 这确实帮助我做出了回应。我将链接保存在我的浏览器 工具栏上,并在一天中定期检查它们。我打电话给我的客户 然后他们打电话给我说我正在处理我发布到我的 错误网站的问题。这真让他们印象深刻! Danny J. Lesandrini dl * ********@hotmail.com http:/ /amazecreations.com/datafast/ 公共函数UpdateDataFastWebErrorLog(ByVal lErr As Long,_ sDescr As String,sObject As String,sFunction作为String,_ lLine As Long,sLogin As String,sUser As String)As Long On Error Resume Next Dim objDoc As SHDocVw.InternetExplorer Dim strSURL As String strSURL ="" strSURL = strSURL& "客户= QUOT; &安培; gcstr_Client strSURL = strSURL& "&安培; ERR = QUOT; &安培; lErr strSURL = strSURL& "&安培; DESCR = QUOT; &安培; sDescr strSURL = strSURL& "&安培; OBJ =" &安培; sObject strSURL = strSURL& "&安培; FN =" &安培;功能 strSURL = strSURL& "&安培;线= QUOT; &安培; lLine strSURL = strSURL& "&安培;登录名=" &安培; sLogin strSURL = strSURL& "&安培;用户= QUOT; &安培; sUser strSURL = strSURL& "& ID = -1& btnSave = yes" 设置objDoc =新SHDocVw.InternetExplorer objDoc.Navigate strSURL ,,,, True ''在点击URL时需要暂停执行。 ForcePause 1 UpdateDataFastWebErrorLog = Err.Number 结束功能 Sub ForcePause(lSeconds As Long) On Error GoTo Err_Handler Dim lngPauseTime作为Long''暂停的时间 Dim lngStart As Long''开始时间 Dim lngFinish As Long''计时器功能的结束时间 lngPauseTime = lSeconds lngStart =定时器''设置开始时间。 ''定时器小于开始和等待的秒数 Do While Timer< lngStart + lSeconds ''将控制权传递给操作系统 DoEvents 循环 lngFinish =计时器''设置结束时间。 Exit_Here: 退出Sub Err_Handler: ''日志错误 简历Exit_Here 结束子FWIW with respect to error handlers, I''ve recently added a new feature.A few months ago, I wrote a silly article about how to pass small amountsof data from your Access app, through the firewall to an off-site database. http://www.databasejournal.com/featu...le.php/3491216After that, I came up with the idea of having my client mdbs log the errorslocally, but also send a copy to my server, via an ASP page that inserts thedata. You can see it for yourself at this site http://www.amazecreations.com/Client...ort=1&filter=2I simply add this function and call it from my error handler. So, even if theuser''s network server is unavailable, I still see the message, so long as theirInternet connection doesn''t go down.This has really helped me to be responsive. I keep the link on my browsertoolbar and check them periodically throughout the day. I''ve called my clientbefore they called me to say I''m working on an issue I saw posted to myerror site. That really impressed them!Danny J. Lesandrini dl*********@hotmail.com http://amazecreations.com/datafast/Public Function UpdateDataFastWebErrorLog(ByVal lErr As Long, _sDescr As String, sObject As String, sFunction As String, _lLine As Long, sLogin As String, sUser As String) As LongOn Error Resume NextDim objDoc As SHDocVw.InternetExplorerDim strSURL As StringstrSURL = ""strSURL = strSURL & "?client=" & gcstr_ClientstrSURL = strSURL & "&err=" & lErrstrSURL = strSURL & "&descr=" & sDescrstrSURL = strSURL & "&obj=" & sObjectstrSURL = strSURL & "&fn=" & sFunctionstrSURL = strSURL & "&line=" & lLinestrSURL = strSURL & "&login=" & sLoginstrSURL = strSURL & "&user=" & sUserstrSURL = strSURL & "&ID=-1&btnSave=yes"Set objDoc = New SHDocVw.InternetExplorerobjDoc.Navigate strSURL, , , True'' Need something to pause execution while URL is hit.ForcePause 1UpdateDataFastWebErrorLog = Err.NumberEnd FunctionSub ForcePause(lSeconds As Long)On Error GoTo Err_HandlerDim lngPauseTime As Long '' The time to pause forDim lngStart As Long '' The start timeDim lngFinish As Long '' The finish time of the timer functionlngPauseTime = lSecondslngStart = Timer '' Set start time.'' Do while the Timer is less than the start and the seconds to waitDo While Timer < lngStart + lSeconds'' Pass control to the OSDoEventsLooplngFinish = Timer '' Set end time.Exit_Here:Exit SubErr_Handler:'' log errorResume Exit_HereEnd Sub 这篇关于缩短尝试连接到后端的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-23 04:50