Results 1 to 7 of 7

Thread: More problems with system.mdw

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    25

    Question

    First look at this thread
    http://forums.vb-world.net/showthrea...threadid=18310

    It was my fault to say at the end
    I got it all squared away now.
    There are more problems...

    I installed Ms-Access on the computer and found the program that makes workgroups - I made my own .mdw file, too.

    But now, every time I try to run my program, I get the run-time error '3049', which says "Can't open database ''. It may not be a database that your application recognizes, or the file may be corrupt."

    Does anyone know how to get around this problem?

    Please Help.

    ______

    Bob K.

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Put up your code where you're opening your database (dummy up the user id and password, for your protection).

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    25

    Red face

    Sorry, What do you mean:
    Put up your code
    If you mean physically locate the code to be where I open the database, it is already there.

    Otherwise, please explain further.

    Thanks,

    ______

    Bob K.

  4. #4

  5. #5
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    The only code, in this thread segment OR the other, was put up by JimBob:

    DBEngine.SystemDB = "c:\windows\system\system.mdw"
    Set ws = CreateWorkspace("Ticketing", "Admin", "", dbUseJet)


    If I were you, after dbengine.systemdb I would add:

    DBEngine.DefaultUser= "username" 'the user that has the authority to open the database
    DBnEngine.DefaultPassword="" 'password for the above user

    Then Open the database with:

    Set ws=CreateWorkspace(Cath\database.mdb")



  6. #6

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    25
    Marty: Thanks for the clarification. Here's the code I want to use
    Code:
    DBEngine.SystemDB = "C:\ServerProject\Server.mdw"
    DBEngine.DefaultType = dbUseJet
    Set UsrName = Workspaces(0).CreateUser("UserName", , "123456789")
    Workspaces(0).Users.Append UsrName
    Set WsNew = CreateWorkspace("SpecialWorkspace", "UserName", "123456789")
    Workspaces.Append WsNew
    Obviously, I had previously declared all those objects as the proper types.

    I still get stupid error # 3049, though. I can't figure it out.

    JHausmann: You can't use CreateWorkspace with a database name as the parameter. I did the other things you said, though, but I still get that error.

    Any other suggestions? Am I writing the code wrong?

    Please Help.

    Thanks,

    ______

    Bob K.

  7. #7
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Sorry. You've got no code to open the database.

    Instead of what you have


    Use:

    global gdbDbase as dao.database

    'then in the subroutine
    DBEngine.SystemDB = "c:\windows\system\system.mdw"
    DBEngine.DefaultUser= "username" 'the user that has the authority to open the database
    DBEngine.DefaultPassword="" 'password for the above user
    Set gdbDbase=Workspaces(0).OpenDatabase(path\database.mdb")

    Then, when you reference recordsets, to do the work, you preceed the command with the open database.

    for example, to read all the records from a table you would do:

    Dim rsTest as Recordset

    set rsTest= gdbDbase.CreateSnapshot("select * from table")

    (in ADO I would use:
    SQLString="Select * from table"
    Set rsTest = gdbDbase.OpenRecordset(SQLString, ))dbOpenSnapshot)






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