Results 1 to 3 of 3

Thread: problems with closing a recordset

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2001
    Posts
    98

    problems with closing a recordset

    i have a recordset in which i close the connection and then i open an access application. i have tried everything from using a seperate connectionvariable and closing the connection and the database to using just a recordset and closing it to halting the program so that the .ldb file disappears. has anyone had this problem before? any suggestions? (even though i probably tried them all)

    thanbks, PJ

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    There are a couple of things that come to mind.

    The main one is completely flushing out the reference to the connection and memory the variable takes up by setting it to nothing after you close it :

    Conn.close
    Set Conn = nothing

    Can we see your current coding for this part though please ?

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2001
    Posts
    98
    yes, i have tired that also. here is my code. i am working on a bigger scale program, this is just a portion of it.

    Public acc_app As Access.Application
    Public rst As ADODB.Recordset
    Public conn As ADODB.Connection
    Private Sub Command1_Click()
    Set rst = New ADODB.Recordset
    Set conn = New ADODB.Connection
    rst.Source = "T1"
    conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\kulickpj\My Documents\electronic_forms.mdb;Persist Security Info=False"
    rst.ActiveConnection = conn
    rst.LockType = adLockOptimistic
    rst.CursorType = adOpenStatic
    rst.Open Options:=adCmdTable
    End Sub
    Private Sub Command2_Click()
    rst.Close
    Set rst = Nothing
    conn.Close
    Set conn = Nothing
    Set acc_app = New Access.Application
    acc_app.OpenAccessProject "C:\Documents and Settings\kulickpj\My Documents\electronic_forms.mdb"
    acc_app.Visible = True
    End Sub

    i made up this little project to simulate what is happening in my big project and i still get the same error. basically, the rst will be opened first when you click on command1, then you will click on command2 and i get the error that access can't open the file because it is missing or being used exclusively by another user.

    thanks, PJ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width