Using a variable to allow opening multiple Access databases

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • VB4DUMMYPOSTERCHILD
    New Member
    • Apr 2007
    • 3

    #1

    Using a variable to allow opening multiple Access databases

    Hi, this is my first time posting a question so please bear with me. I am a novice at VB2005 and looking for help utilizing a variable to call open a database. This will allow me to chose which access database (with similar tables) I want to open utilizing the same form. I currently do this in VB6. I can open multiple instances of the same or different databases as an mdichild inside a parent form. I have not found out how to do this in 2005. Any help is appreciated. Thanks.
  • VB4DUMMYPOSTERCHILD
    New Member
    • Apr 2007
    • 3

    #2
    Just thought I would provide some more information. The line of code that I am trying to modify is shown below

    connectionStrin g="Provider=Mic rosoft.Jet.OLED B.4.0;Data Source="C: \books.mdb&quot ;"

    What I would like to do is replace the MS Acess file name (or name and path) with a variable such as "textbox1.t ext" or the "OpenFileDialog .FileName" but I can't get it to read the actual text contained in those string variables. If I am mis-using terms, please forgive me as I have not been formally trained in VB.
    Last edited by VB4DUMMYPOSTERCHILD; Apr 3 '07, 11:18 AM. Reason: Making file name simpler

    Comment

    • vijaydiwakar
      Contributor
      • Feb 2007
      • 579

      #3
      Originally posted by VB4DUMMYPOSTERC HILD
      Just thought I would provide some more information. The line of code that I am trying to modify is shown below

      connectionStrin g="Provider=Mic rosoft.Jet.OLED B.4.0;Data Source="C: \books.mdb&quot ;"

      What I would like to do is replace the MS Acess file name (or name and path) with a variable such as "textbox1.t ext" or the "OpenFileDialog .FileName" but I can't get it to read the actual text contained in those string variables. If I am mis-using terms, please forgive me as I have not been formally trained in VB.
      No don't do like that
      before opening new form u've to make the main form as mdi parent then make new instance of new form and set its mdiparent=me and then show it
      Try it
      Good Luck

      Comment

      • VB4DUMMYPOSTERCHILD
        New Member
        • Apr 2007
        • 3

        #4
        Originally posted by vijaydiwakar
        No don't do like that
        before opening new form u've to make the main form as mdi parent then make new instance of new form and set its mdiparent=me and then show it
        Try it
        Good Luck

        I have already worked out the parent child relationship and I can open up multible instances of the child form referencing the same database. What I need help with is opening one instance with book1.mdb as the data source and another instance with book 2.mdb as the data source. Both would have the same titles such as author, publish date, etc...

        Comment

        Working...