问题描述
Access 2002.我有一个3 MB的数据库连接到位于远程服务器上的后端。它花了大约1分钟。使用任何方法退出程序时关闭。没有错误消息,只需要一分钟的沙漏,然后关闭。我将
缩小到主表单上的自定义查找实用程序。它只是一个用户在ID中输入的文本字段,在afterupdate事件中我有这个代码:
Private Sub txtGrievID_AfterUpdate()
  Dim rs As DAO.Recordset
ShowCurrentRecs
如果不是IsNull(Me.txtGrievID)则为
'移动前保存。
如果是Me.Dirty然后是
Me.Dirty = FUE
结束如果
'在克隆集中搜索。
设置rs = Me.RecordsetClone
rs.FindFirst"[GrievNumber] =" &安培; Me.txtGrievID为
如果rs.NoMatch则为
MsgBox"未找到:#" &安培; Me.txtGrievID& "                ",vbInformation," Not Found"
$
否则为
'在表单中显示找到的记录。
Me.Bookmark = rs.Bookmark
结束如果
设置rs =无结果
结束如果
结束子
公共功能ShowCurrentRecs()
DoCmd.ApplyFilter"qryGrievances","[qryGrievances]![Archive] = False" b
DoCmd.GoToRecord acDataForm,"frmGrievances",acLast
Me.txtGrievID.Value ="" '清除搜索字段
Me.txtInmateID.Value ="" '清除搜索字段
结束功能
我发现如果我在会话期间不使用此搜索功能,则当我退出时应用会立即关闭。如果我使用搜索字段,则会发生缓慢关闭。上面的代码怎么可能导致这个呢?
非常感谢!
Ripper T
Access 2002. I have a 3 mb DB connected to a back end located on a remote server. It has been taking about 1 min. to close when exiting the program using any method. No error messages, just an hourglass for up to a minute, then it closes. I narrowed it down to a custom find utility I have on the main form. It's just a text field that the user types in an ID and in the afterupdate event I have this code:
Private Sub txtGrievID_AfterUpdate()
Dim rs As DAO.Recordset
ShowCurrentRecs
If Not IsNull(Me.txtGrievID) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[GrievNumber] = " & Me.txtGrievID
If rs.NoMatch Then
MsgBox "Not found: #" & Me.txtGrievID & " ", vbInformation, "Not Found"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub
Public Function ShowCurrentRecs()
DoCmd.ApplyFilter "qryGrievances", "[qryGrievances]![Archive]=False"
DoCmd.GoToRecord acDataForm, "frmGrievances", acLast
Me.txtGrievID.Value = "" 'clears search field
Me.txtInmateID.Value = "" 'clears search field
End Function
I find that if I don't use this search feature during a session, the app closes instantly when I exit. If I do use the search field, then the slow closing occurs. What about the above code might cause this?
Many thanks!
Ripper T
这篇关于DB需要很长时间才能关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!