Merging Two Access DATABASES

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gaubun
    New Member
    • Jan 2008
    • 6

    Merging Two Access DATABASES

    Hi All,

    Just joined this site....I am really stuck into one problem. Actually I am writing a code in VB6 to merge TWO ACCESS DATABASES. Wanted to know if I can use a single sql query to merge. Is MERGE or UNION effective in merging two DATABASES. Plz help.
    I am looking forward to get some positive replies.
    Thanx in advance.

    Gaurav
  • gaubun
    New Member
    • Jan 2008
    • 6

    #2
    and yeah I forget to mention that structures are same.

    Gaurav

    Comment

    • vksingh24
      New Member
      • Dec 2007
      • 21

      #3
      Originally posted by gaubun
      and yeah I forget to mention that structures are same.

      Gaurav
      No sure what you want. But it seems that you have two Access database and you want to access data of both databases.

      You can create a Link Objects (Table /Query) of Database A, into Database B and Query them.

      Comment

      • gaubun
        New Member
        • Jan 2008
        • 6

        #4
        Originally posted by vksingh24
        No sure what you want. But it seems that you have two Access database and you want to access data of both databases.

        You can create a Link Objects (Table /Query) of Database A, into Database B and Query them.

        Hi vksingh

        In simple words...I want to combine to identical Access databases into one and that to from vb6. Just need a hint to get started....can I do this by using adodc? or should I have to use some database object like
        "dim db1 as database"
        but I don't know how to manipulate this object? Jz need a little help.

        Gaurav

        Comment

        • jaxjagfan
          Recognized Expert Contributor
          • Dec 2007
          • 254

          #5
          Originally posted by gaubun
          Hi All,

          Just joined this site....I am really stuck into one problem. Actually I am writing a code in VB6 to merge TWO ACCESS DATABASES. Wanted to know if I can use a single sql query to merge. Is MERGE or UNION effective in merging two DATABASES. Plz help.
          I am looking forward to get some positive replies.
          Thanx in advance.

          Gaurav
          If the 2 have identical field types then union will work. Just make a UNION query.

          Select TableA.* From TableA;
          UNION
          Select TableB.* From TableB;

          You will end up with the column names from TableA as column names.

          I am unsure of the VB syntax it differs a little with VBA. It depends on the display method (Form, datagrid, report, etc)

          Comment

          • FishVal
            Recognized Expert Specialist
            • Jun 2007
            • 2656

            #6
            Originally posted by gaubun
            Hi All,

            Just joined this site....I am really stuck into one problem. Actually I am writing a code in VB6 to merge TWO ACCESS DATABASES. Wanted to know if I can use a single sql query to merge. Is MERGE or UNION effective in merging two DATABASES. Plz help.
            I am looking forward to get some positive replies.
            Thanx in advance.

            Gaurav
            Hi, gaubun.

            Do you want to work with both as a single one or do you want work with each?
            If you are mentioning the first, then I would like to stay that it is generally a bad practice.
            • all datasets obtained with UNION operation will be read-only
            • to tell nothing about indexed fields duplicating
            • etc


            Is that an option to import all info from one db to another and work with the latter only? Or from some special reasons you want to stay with this configuration?

            Regards,
            Fish

            P.S. Or you just want to retrieve only some special information?

            Comment

            • gaubun
              New Member
              • Jan 2008
              • 6

              #7
              Originally posted by FishVal
              Hi, gaubun.

              Do you want to work with both as a single one or do you want work with each?
              If you are mentioning the first, then I would like to stay that it is generally a bad practice.


              Hi Fish,

              Thanx for your concern.
              "Do you want to work with both as a single one or do you want work with each?
              If you are mentioning the first, then I would like to stay that it is generally a bad practice."


              Actually I am merging some village databases to its upper level i.e Subcenters or SCs database and then will use latter to generate reports. I am not going to manipulate ANY OF THE VILLAGE DATABASES. SC database is a temporary one...used only for report generations.
              Suppose if I have two village databases (A and B) and one EMPTY DATABASE WITH SAME STRUCTURE (i.e C)
              Now what I want is.......
              C=A+B :-D

              Now my problem is how can do this through Programming if Im using vb6 as frontend.

              Currently I am connecting through Adodc but my knowledge is limited to
              adodc1.recordso urce="select... ...."
              adodc1.refersh
              adodc1.recordse t.....blah blah blah

              So how can I truncate/delete SC database and merge village database into it.

              I tried to make it very clear.... plz help.

              Comment

              Working...