Results 1 to 4 of 4

Thread: [RESOLVED] do these database functions require Access Installed?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2007
    Location
    Melbourne, Australia
    Posts
    362

    Resolved [RESOLVED] do these database functions require Access Installed?

    if i call for these functions to take place inside the mdb database backend from my VB frontend;

    database compact & Repair

    do they require that Access be installed on the client machines? if so what is an easy way to code into VB (classic) to check if Access is installed?


    Cheers

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: do these database functions require Access Installed?

    No, I have a compact and repair routine in one of my apps that works fine with and without Access installed. I've included the code below. Hope this helps

    vb Code:
    1. Sub CompactDatabase()
    2. Dim source_path As String
    3. Dim Target_path As String
    4.  
    5. On Error Resume Next
    6. 'Compact Database
    7. source_path = App.Path & "\" & SelectedDatabase
    8. Target_path = App.Path & "\CompactResearch.mdb"
    9.  
    10. If compactDB(source_path, Target_path) = False Then
    11. 'Need to check if CompactDatabase.mdb is there because it needs to be deleted
    12.     If Dir$(Target_path) <> "" Then
    13.     Kill "" & Target_path & ""
    14.     End If
    15.    
    16. Else
    17. Kill "" & source_path & ""
    18. Name "" & Target_path & "" As "" & source_path & ""
    19. End If
    20.  
    21. End Sub
    22.  
    23. Public Function compactDB(ByVal SOUR_path As String, ByVal DEST_path As String) As Boolean
    24.  
    25.   On Error GoTo Err_compact
    26.   Dim JRO As New JRO.JetEngine
    27.  
    28. ' Source and Destination connection path
    29.   Dim DB_sour As String, DB_dest As String
    30.  
    31.   DB_sour = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    32.            "Data Source=" & SOUR_path & "; Jet OLEDB:Database Password=XYZ123;"
    33.    
    34.    DB_dest = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    35.            "Data Source=" & DEST_path & "; Jet OLEDB:Database Password=XYZ123;"
    36.            
    37. DoEvents
    38. 'Compact Database
    39. JRO.CompactDatabase DB_sour, DB_dest
    40.  
    41. compactDB = True
    42. Exit Function
    43.  
    44. Err_compact:
    45.   compactDB = False
    46.  
    47. End Function

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: do these database functions require Access Installed?

    The only time you would need Access installed is if you were doing something that required the database itself to open such as calling a built in Access Report.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2007
    Location
    Melbourne, Australia
    Posts
    362

    Re: do these database functions require Access Installed?

    excellent thanks

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