Firs of all thank you for taking interest, I am having a problem over the Compact & Repair in my app and the problem occurs when I hit the Compact & Repair button I get a error message saying: "7866 - Microsoft Office Access can't open the database because it is missing, or opened exclusively by another user, or or it is not an ADP file." However during that process Access file is not missing, opened or used by someone else. This started happening when I have added the password on to the Access file.
Other Question refers to the delete of records in the access file, here everything works fine except when the last record in the access file is deleated it stays on screen until the application restarts next time.Code:Private Sub cmdC_R_Click() On Error GoTo MyError Dim oApp As Access.Application Set oApp = New Access.Application oApp.CompactRepair "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Data\File.mdb;Persist " & _ "Security Info=False;Jet OLEDB:Database Password=pa00word", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Data\FileCR.mdb;Persist " & _ "Security Info=False;Jet OLEDB:Database Password=pa00word", False Kill App.Path & "\Data\File.mdb" Name App.Path & "\Data\FileCR.mdb" As App.Path & "\Data\File.mdb" MsgBox "Kompaktiranje i Popravka zavrseni!", vbOKOnly, MSGTITLE oApp.Quit acQuitSaveNone Set oApp = Nothing Exit Sub MyError: MsgBox Err.Number & " - " & Err.Description, vbOKOnly End Sub
Any help is greatly appreciated!Code:If Not (ar.BOF = True Or ar.EOF = True) Then ar.Delete 'delete the current record If Not (ar.BOF = True Or ar.EOF = True) Then ar.MoveNext 'move next If ar.EOF Then ar.MoveLast PopulateControls 'fill the controls End If End If




Reply With Quote