Tech Off Thread

1 post

Access - Changing the Current Session Workgroup File?

Back to Forum: Tech Off
  • User profile image

    Documentation states the currently open database session mdw cannot be reassigned because DBEngine.SystemDB is read only.

    You can however reassign the mdw for another database which seems at odds with this. Is the latter really impossible?

    Paraphrasing some code:

    MyOldMDW = DBEngine.SystemDB
    DBEngine.SystemDB = c:\myfolder\mynew.mdw
    wsp = DBEngine.CreateWorkspace("x", "U1","Psw")
    dbs = wsp.OpenDatabase(CurrentDB.Name, false,false)
    . Do something
    DBEngine.SystemDB = MyOldMDW

    The 'wsp =' line, errors, as user not found. This is because U1 is not a user in the old mdw but is a user in the new one and the mdw never got reassigned.

    The line DBEngine.SystemDB = c:\myfolder\mynew.mdw does not error because Access has no way of knowing what you are going to do next.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.