Results 1 to 6 of 6

Thread: [RESOLVED] Back-up and restore using DAO,Acces as Database,vb6 application

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2009
    Location
    Manila, Phillippines
    Posts
    54

    Resolved [RESOLVED] Back-up and restore using DAO,Acces as Database,vb6 application

    Hello Experts,

    I got an error while backing up ms access database using vb6.0, the error is "Cannot start your application. The workgroup information file is missing or opened exclusively by another user."..I have no idea about this, I'm using DAO and common dialog to saved mdb file..please help


    Thanks,

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Back-up and restore using DAO,Acces as Database,vb6 application

    How are you doing it?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2009
    Location
    Manila, Phillippines
    Posts
    54

    Re: Back-up and restore using DAO,Acces as Database,vb6 application

    Quote Originally Posted by dee-u View Post
    How are you doing it?
    Thanks for the reply

    I have 1 command button called "Back up Database", When I click it, common Dialog appear to save .mdb file,but there's no error appear, but in the Immediate window there is a log ""Cannot start your application. The workgroup information file is missing or opened exclusively by another user."",..and also no data saved in the folder...

    Here's my code :

    Dim myDatabasePath As String
    Dim strFileName As String

    myDatabasePath = "D:\Information.mdb" ' my original db file

    With CommonDialog1
    .Filter = "MS Access DB File | *.mdb"
    .ShowSave
    If Len(.FileName) > 0 Then
    strFileName = .FileName
    Else
    Exit Sub
    End If
    End With

    On Error GoTo Err
    Dim Conn As New DAO.DBEngine
    Dim strSource As String
    Dim strDest As String


    SetAttr myDatabasePath, vbNormal
    strSource = "DataSource=" & myDatabasePath & ",Username=Admin;Password=admin;,"
    strDest = "DataSource=" & strFileName & ",dbengine(0)"

    Conn.CompactDatabase strSource, strDest

    Set Conn = Nothing

    Exit Sub
    Err:
    Debug.Print Err.Description

    Thanks,
    Last edited by ryanbesitulo; Nov 16th, 2009 at 04:55 AM.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Back-up and restore using DAO,Acces as Database,vb6 application

    Quote Originally Posted by ryanbesitulo View Post
    there's no error appear, but in the Immediate window there is a log ""Cannot start your application. The workgroup information file is missing or opened exclusively by another user.""
    Due to the error handler you have got, that clearly is an error appearing - you have just chosen to re-direct the message to the Immediate window rather than the screen.


    It has been many years since I used DAO, so I don't know exactly what .CompactDatabase expects... but I suspect the values you have got in strSource and strDest are not quite right.

    Another possible issue is that one (or both) of the databases might currently be in use, but I would expect a different error in that situation.

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2009
    Location
    Manila, Phillippines
    Posts
    54

    Re: Back-up and restore using DAO,Acces as Database,vb6 application

    Quote Originally Posted by si_the_geek View Post
    Due to the error handler you have got, that clearly is an error appearing - you have just chosen to re-direct the message to the Immediate window rather than the screen.


    It has been many years since I used DAO, so I don't know exactly what .CompactDatabase expects... but I suspect the values you have got in strSource and strDest are not quite right.

    Another possible issue is that one (or both) of the databases might currently be in use, but I would expect a different error in that situation.
    Thanks for the reply..

    I Changed the code on how to back-up...but i got an error, said that "Permission denied"

    Here's my code:

    Private Sub Back_Click()
    Dim Conn as new ADODB.Connection
    Dim Source As String
    Dim Destination As String


    Source = App.Path & "\Pensioner.mdb"
    Destination = App.Path & "\Backup\" & Format(Date, "mmmm dd, yyyy") & " " & Format(Time, "h_mm_ss") & ".mdb"
    FileCopy Source, Destination

    MsgBox " Backup Successfully Saved!", vbInformation, ""
    Conn.Open
    End Sub

    Thanks,

  6. #6

    Thread Starter
    Member
    Join Date
    Nov 2009
    Location
    Manila, Phillippines
    Posts
    54

    Re: Back-up and restore using DAO,Acces as Database,vb6 application

    Quote Originally Posted by ryanbesitulo View Post
    Thanks for the reply..

    I Changed the code on how to back-up...but i got an error, said that "Permission denied"

    Here's my code:

    Private Sub Back_Click()
    Dim Conn as new ADODB.Connection
    Dim Source As String
    Dim Destination As String


    Source = App.Path & "\Pensioner.mdb"
    Destination = App.Path & "\Backup\" & Format(Date, "mmmm dd, yyyy") & " " & Format(Time, "h_mm_ss") & ".mdb"
    FileCopy Source, Destination

    MsgBox " Backup Successfully Saved!", vbInformation, ""
    Conn.Open
    End Sub

    Thanks,
    Yes.... I got it



    Thanks both of you..

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