none
DAO Access to a Backend Database RRS feed

  • Question

  • I split a Database.  What is the format of a 'Set dbs='  to the Linked Database.  I was using set dbs=currentdb.  What do I use in place of curentdb after the Split.  
    Thursday, November 1, 2012 12:52 AM

Answers

  • Hi KMAV - Access question on an apps for Office forum? Cheeky, however the miracle that is Bing reveals:

    <snip>

    Thanks - but it turns out that I missed the solution to be found in... the
    HELP file!  Clicking F1 on CurrentDb in the VBE revealed the following:

    If you need to work with another database at the same time that the current
    database is open in the Microsoft Access window, use the OpenDatabase method
    of a Workspace object. The OpenDatabase method doesn't actually open the
    second database in the Microsoft Access window; it simply returns a Database
    variable representing the second database. The following example returns a
    pointer to the current database and to a database called Contacts.mdb:

    Dim dbsCurrent As Database, dbsContacts As Database
    Set dbsCurrent = CurrentDb
    Set dbsContacts = DBEngine.Workspaces(0).OpenDatabase("Contacts.mdb")

    It solved the problem.  Who would have thought that the Access VBA help file
    might actually be helpful!

    </snip>

    Cheers...pc

    Tuesday, November 6, 2012 1:27 AM

All replies

  • Hi KeithMartinAndersonValley,

    Thank you for posting in the MSDN Forum.

    Could you please tell me

    • What kind of project are you programming with?
    • What software are you using in your project?
    • What do you want to achieve?

    I look forward to your reply.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us

    Friday, November 2, 2012 9:49 AM
    Moderator
  • Hi KMAV - Access question on an apps for Office forum? Cheeky, however the miracle that is Bing reveals:

    <snip>

    Thanks - but it turns out that I missed the solution to be found in... the
    HELP file!  Clicking F1 on CurrentDb in the VBE revealed the following:

    If you need to work with another database at the same time that the current
    database is open in the Microsoft Access window, use the OpenDatabase method
    of a Workspace object. The OpenDatabase method doesn't actually open the
    second database in the Microsoft Access window; it simply returns a Database
    variable representing the second database. The following example returns a
    pointer to the current database and to a database called Contacts.mdb:

    Dim dbsCurrent As Database, dbsContacts As Database
    Set dbsCurrent = CurrentDb
    Set dbsContacts = DBEngine.Workspaces(0).OpenDatabase("Contacts.mdb")

    It solved the problem.  Who would have thought that the Access VBA help file
    might actually be helpful!

    </snip>

    Cheers...pc

    Tuesday, November 6, 2012 1:27 AM