我如何解决这个错误。 “运行时间3709” [英] How do I fix this error I get. "Run - time 3709"

查看:297
本文介绍了我如何解决这个错误。 “运行时间3709”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Button Code:

Private Sub cmdnew_Click()
no
clear
Dim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
rs.Open "tbltrans", con, adOpenDynamic, adLockPessimistic 'This is the line where I get the error.

rs.AddNew

rs!transid = txttransid.Text

rs.Update
lbltotal.Caption = 0
txtitemcode.SetFocus
txtpaid.Text = ""
txtchange.Text = ""
cmdadd.Enabled = True
cmdnew.Enabled = False
cmddelete.Enabled = True
cmdedit.Enabled = True
cmdcompute.Enabled = True
End Sub

Module Code: 

Global con As New ADODB.Connection
Sub main()
On Error GoTo err
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\pos.mdb;Persist Security Info=False;Jet OLEDB:Database"
frmmain.Show
Exit Sub
err:
MsgBox ("Could not find database")
End Sub





我的尝试:



当我删除 frmLogin frmSplash frmMenu 时错误消失了,我可以成功启动一个新事务。



What I have tried:

When I removed the frmLogin , frmSplash and frmMenu the error is gone and I can successfully start a new transaction.

推荐答案

如果你不理解错误信息,请谷歌:运行时间3709 vb6 - Google搜索 [ ^ ]并且跟随任何链接将完成消息并可能解释它的含义:

If you don't understand an error message, google it: run - time 3709 vb6 - Google Search[^] and following any of the links will complete the message and probably explain what it means:
VB6 run-time error 3709 the connection cannot be used to perform the operation-it is either closed or invalid



所以使用调试器查看你的连接并找出teh连接命令的确切结果。

然后检查该文件夹中是否存在该文件(它不应该存在,即使你在开发中工作也会因为Program Files文件夹被写保护而在生产中失败)。


So look at your connection using the debugger and find out exactly what teh connection command works out as.
Then check the file exists in that folder (and it shouldn't be there, that will fail in production even if you get it working in development as the Program Files folder is write protected).


这篇关于我如何解决这个错误。 “运行时间3709”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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