• Invisible database (Access 2000)

    Author
    Topic
    #416143

    I was told that i could make the database invisible with Shell Attrib
    but neither ‘Shell “Attrib ” & ANewDB & ” +h”
    nor
    Shell “Attrib +h”
    give any results.
    What can i add on my code?

    Private Sub Command2_Click()
    Call ANewDB(“c:BENewDB.mdb”)
    ‘Shell “Attrib ” & ANewDB & ” +h”
    Shell “Attrib +h”
    End Sub
    Function ANewDB(tName As String)
    Dim wsp As Workspace, db As Database
    Dim db2 As Database
    Set db = CurrentDb
    Set wsp = DBEngine.Workspaces(0)
    Set db2 = wsp.CreateDatabase(tName, dbLangGeneral)
    db2.Close
    End Function

    Viewing 0 reply threads
    Author
    Replies
    • #929847

      Shell “Attrib ” & ANewDB & ” +h”
      should work if the function ANewDB return the path and the file name.

      • #929849

        Thank you for your reply.I receive the error “argument not optional pointing to ANewDB
        But i have alsready shown the path name : the new database should be in the folder BE and have the name NewDB :
        Call ANewDB(“c:BENewDB.mdb”)
        Shell “Attrib ” & ANewDB & ” +h”

        Why do i get the error ?

        regards

        • #929850

          Sorry, I hadn’t seen that you post the function also.
          The function ANewDB did not return the name of the db, but create and close it.
          You could use :

          Private Sub Command2_Click()
          Shell “Attrib ” & ANewDB(“c:BENewDB.mdb”) & ” +h”
          End Sub

          Function ANewDB(tName As String)
          Dim wsp As Workspace, db As Database
          Dim db2 As Database
          Set db = CurrentDb
          Set wsp = DBEngine.Workspaces(0)
          Set db2 = wsp.CreateDatabase(tName, dbLangGeneral)
          ANewDB = db2.Name
          db2.Close
          End Function

    Viewing 0 reply threads
    Reply To: Invisible database (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: