Problem with Appending Tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manojspromantr
    New Member
    • Feb 2009
    • 4

    Problem with Appending Tables

    I'm trying to append some data from one table to another table both the table structure are same. I have an attachments field in both tables but it seems that i cannot append the attachments from one table to the other.

    I get the following error when trying to just append the attachments field to the appropriate field:

    "An INSERT INTO query cannot contain a multi-valued field"
    I also get the following error when trying to append the attachments sub fields to the appropriate sub field;

    "An INSERT INTO query that contains a multivalued field cannot contain another field"
    Has anyone found a way of merging, appending or updating databases with attachments???? ?

    Many thanks in advance for any help.


    Manoj Kumar
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    This is not going to be quite so simple. You may want to take a look at How to: Work With Attachments In DAO

    Comment

    • manojspromantr
      New Member
      • Feb 2009
      • 4

      #3
      I am not able to do this... Is there any other option to do this..


      Thanks
      Manoj Kumar

      Comment

      • Stewart Ross
        Recognized Expert Moderator Specialist
        • Feb 2008
        • 2545

        #4
        Chip has very helpfully found an MSDN entry on how to process a set of attachments and provided the link for you. Extracting the attachments is not inherently difficult; it amounts to processing a child recordset (containing the attachments) from a parent recordset (containing the records with the attachment fields). The MSDN article provides code samples which can be copied straight into your own project.

        Attaching them to the other table may be more of a challenge, but in effect it is just the reverse of extracting them. You would loop through your parent recordset, and as you do so you would add entries to the other table. When it comes to the attachments, instead of saving them (which is what the MSDN article does) you would attach them to the attachment field of the current record that has been copied into the second table.

        It is unlikely that a simpler way to deal with copying such attachments is available.

        -Stewart

        Comment

        Working...