处理使用VBA一个SQL Server登录错误味精? [英] Handling a SQL Server Login error msg with VBA?

查看:625
本文介绍了处理使用VBA一个SQL Server登录错误味精?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作在VBA模块访问的查询链接表,生成基于关闭数据报告,然后使用PDF打印机保存到磁盘的报告。有初级形式的计时器将每隔N秒,运行反对JOBQUEUE表的Access查询,看看是否有新的就业机会。

I'm working in a VBA module for Access that queries linked tables, generates reports based off the data, and then uses a PDF printer to save the reports to disk. There's a timer in the primary form that will, every N seconds, run an Access query against a "JOBQUEUE" table to see if there are new jobs.

如果数据库服务器不可用,这种操作当然时间会出来。正在记录的3051的运行时错误,循环会尝试继续。循环却无法完成,因为以下错误VB运行时错误后立即就来。

If the database server becomes unavailable, this operation will of course time out. The run-time error of 3051 is being logged, and the loop will try to continue. The loop can't finish, however, because the following error comes right after the VB Run-Time error;

标题是微软SQL服务器登录,所以它不是在VB,据我可以告诉。

Title is "Microsoft SQL Server Login", so it's not within VB as far as I can tell.

Connection Failed:
SQLState: '01000'
SQL Server Error: 53
[Microsoft][ODBC SQL Server Driver][DBNETLIB][ConnectionOpen(Connect()).
Connection Failed:
SQLState: '08001'
SQL Server Error: 17
[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not 
exist or access is denied.

在每一个论坛和放大器;讨论中我发现,提到了这个错误,提问者关注的是错误的原因。在这种情况下,我可以假设的错误是暂时的,它需要不断尝试连接,因为安装是无人值守。访问进入一个没有响应......状态时,它选择的时机反对的数据库,而这也没关系,如果恢复连接,然后进入上述MSGBOX,它会拿起它离开的地方和士兵。

In every forum & discussion I've found that mentions this error, the asker is concerned with the cause of the error. In this case, I can assume that the error is temporary, and that it needs to continue trying to connect because the installation is unattended. Access goes into a "Not Responding..." state when it's timing out against the DB, and that's OK too, if connection is restored before it goes into the MsgBox described above, it will pick up where it left off and soldier on.

有谁知道的一种方式,我可以静音的MSGBOX,preferably编程,但我想在这一点上,可以远程进行采取任何不RDP会话。

Does anyone know of a way that I can either mute that msgbox, preferably programatically, but I'd take anything at this point that can be done remotely that isn't an RDP session.

编辑:链接到图片

Link to image

推荐答案

我得到的错误确实不是一个运行时错误,可以从code被抓。相反,它是SQL超时我已经吞下&放后;在我的VBA模块驳回超时的运行时间。

The error I was getting was indeed not a run-time error that could be caught from code. Rather, it was SQL timing out after I already swallowed & dismissed time-outs in run-time in my VBA module.

似乎是错误不会永远出现,现在我已经介绍了新的计时器,重置运行对我的链接表的查询循环。它不能被记录和放大器;吞噬,但它可以通过更聪明约我如何处理在运行时超时pvented $ P $。

The error does not seem to ever appear now that I have introduced a new timer that resets the loop that runs a query against my linked tables. It can't be logged & swallowed, but it can be prevented by being smarter about how I handle timeouts in run-time.

这篇关于处理使用VBA一个SQL Server登录错误味精?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆