我试图运行一个宏,它给我一个运行时错误 [英] I am trying to run a macro and it gives me a run time error

查看:68
本文介绍了我试图运行一个宏,它给我一个运行时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试调试,它在MyConn.Open行给我错误:







Dim MyConn As New ADODB.Connection'For Forecaster Access table



Const ForecasterConnString As String =DSN = Forecaster



Dim i As Integer,strSQL As String,intRows As Integer

Dim PartNum As String,QtyReq As Double,DateReq As String,DateLoaded As Date,LoadedBy As String,strProdCode As String < br $>


MyConn.ConnectionString = ForecasterConnString

如果MyConn.State<> adStateOpen然后

MyConn.Open

结束如果



我尝试过:



请帮我修错误,因为我无法将数据上传到系统中。

I tried to debug and it gives error to me on MyConn.Open line:



Dim MyConn As New ADODB.Connection ' For Forecaster Access tables

Const ForecasterConnString As String = "DSN=Forecaster"

Dim i As Integer, strSQL As String, intRows As Integer
Dim PartNum As String, QtyReq As Double, DateReq As String, DateLoaded As Date, LoadedBy As String, strProdCode As String

MyConn.ConnectionString = ForecasterConnString
If MyConn.State <> adStateOpen Then
MyConn.Open
End If

What I have tried:

Please help me to bug the error as I am not able to upload the data into the system.

推荐答案

您根本不需要使用DSN。在这个时代,我想知道为什么还有人仍然困扰着他们。这只是一个连接字符串,放在一个管理屁股的地方。



如果您制作了系统DSN,请使用您在连接字符串不存在或DSN定义中的连接字符串错误。



如果您创建了文件DSN,则应用中的连接字符串必须指定 FILEDSN = ...。当然,名称仍然必须匹配,DSN文件中的连接字符串必须是好的。



我们无法在这里说出什么是坏的。由你来检查这些东西。
You don't need to use a DSN at all. In this day and age, I wonder why anyone still bothers with them. It's just a connection string put in a place that'a a pain in the ass to manage.

If you made a System DSN, either the name you specified in your connection string doesn't exist or the connection string in the DSN definition is bad.

If you made a File DSN, the connection string in your app has to specify "FILEDSN=...". Of course, the name still has to match and the connection string in the DSN file has to be good.

We have no way of telling what's bad here. It's up to you to check this stuff.


这篇关于我试图运行一个宏,它给我一个运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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