|
程序执行到set db =currentdb时就没有反应了,无出错信息,不执行后面的代码,在设计视图中无法设置断点,导出及复制粘贴该代码出现同样的问题
已建立对DAO的引用
同一数据库中其它程序同样建立对DAO的引用,运行正常
Dim db As DAO.Database, rstzmb As DAO.Recordset, rsthle As DAO.Recordset
Dim rstzmbcx As DAO.Recordset
Dim hlevalue As Currency, strkh As String
Set db = CurrentDb
Set rstzmb = db.OpenRecordset("帐目表", dbOpenDynaset)
MsgBox rstzmb("登帐年月")
rstzmb.FindFirst "[登帐年月]=#" & txtyearmonth.Value & "#"
MsgBox rstzmb("登帐年月")
If rstzmb.NoMatch Then
Else
MsgBox "帐目表中已有登帐数据,请先用取消取消登帐删除数据"
Exit Sub
End If
Dim yhzk As DAO.Recordset
Set yhzk = db.OpenRecordset("应收帐款表", dbOpenDynaset)
rstzmb.FindFirst "[登帐年月]=#" & txtyearmonth.Value & "#"
If rstzmb.NoMatch Then
Else
MsgBox "应收帐款表中已有登帐数据,请先用取消登帐删除数据"
Exit Sub
End If
MsgBox "2"
'追加数据表帐目表
DoCmd.OpenQuery "帐目表追加查询应收帐款"
DoCmd.OpenQuery "帐目表追加查询销售"
DoCmd.OpenQuery "帐目表追加查询回笼"
MsgBox "数据追加完毕"
|
|