Rabu, 06 Februari 2013

[MS_AccessPros] run-time error '91' object variable or with block variable

 

When I open one of my databases normally (not shift enter), when I click on the exit access command on the menu, I get a "run-time error '91' object variable or with block variable."

I finally figure out that it has something to do with a form I use to maintain a permanent connection to the back end.

Following is the code for the form. Note: tblKeepOpen is a linked table in the backend used to maintain the connection.

Can someone please explain what I've done wrong here?

Option Compare Database
Option Explicit
Dim db As DAO.Database, rst As DAO.Recordset

Public rsAlwaysOpen As Recordset
Private Sub Form_Close()
rsAlwaysOpen.Close
Set rsAlwaysOpen = Nothing

End Sub
Private Sub Form_Open(Cancel As Integer)
'Set rs = db.OpenRecordset("tblKeepOpen", dbOpenDynaset)
Set rsAlwaysOpen = CurrentDb.OpenRecordset("tblKeepOpen")
End Sub

John F.

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar