Data mapping with a DAO.Recordset?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jozef

    #1

    Data mapping with a DAO.Recordset?

    Hello,

    I was wondering, is it possible to add to a recordset? i.e. I create a DAO
    recordset with information from one SQL statment, and add records from
    another SQL statement (which grabs info from a different source). Similar
    to data mapping. Is that possible?

    Thanks!


  • Danny J. Lesandrini

    #2
    Re: Data mapping with a DAO.Recordset?

    huh?

    --

    Danny J. Lesandrini
    dlesandrini@hot mail.com




    "Jozef" <me@you.com> wrote ...[color=blue]
    > Hello,
    >
    > I was wondering, is it possible to add to a recordset? i.e. I create a DAO recordset with information from one SQL
    > statment, and add records from another SQL statement (which grabs info from a different source). Similar to data
    > mapping. Is that possible?
    >
    > Thanks!
    >[/color]


    Comment

    • Jozef

      #3
      Re: Data mapping with a DAO.Recordset?

      Well spoken!

      Alright, here is some air code intertwined with some indication of what I'm
      trying to acheive

      Dim rst as DAO.Recordset

      set rst = CurrentDb.OpenR ecordset("Table 1")' This table has three fields
      "Field1, Field2 and Field3"
      'This would return 12 records, all the records in table1

      set rst=rst & currentDb.OpenR ecordset("Table 2")

      ' Pretend that this would work, and table 2 would have three fields as well,
      maybe the same name, may not, but as long as the data types were the same,
      result would be all the records from table1 and appended to that would be
      all the records from table2.

      ....similar to data mapping using an ADO dataset.


      "Danny J. Lesandrini" <dlesandrini@ho tmail.com> wrote in message
      news:c8-dnV-Rk48Ue8veRVn-gA@comcast.com. ..[color=blue]
      > huh?
      >
      > --
      >
      > Danny J. Lesandrini
      > dlesandrini@hot mail.com
      > http://amazecreations.com/datafast/
      >
      >
      >
      > "Jozef" <me@you.com> wrote ...[color=green]
      >> Hello,
      >>
      >> I was wondering, is it possible to add to a recordset? i.e. I create a
      >> DAO recordset with information from one SQL statment, and add records
      >> from another SQL statement (which grabs info from a different source).
      >> Similar to data mapping. Is that possible?
      >>
      >> Thanks!
      >>[/color]
      >
      >[/color]


      Comment

      • lylefair

        #4
        Re: Data mapping with a DAO.Recordset?

        Possibly a Union Query would achieve what you describe. Example:
        SELECT 'Table1' AS Source, IDS AS Field1, Value AS Field2 FROM Table1
        UNION
        SELECT 'tbl2002Transac tions' AS Source, fldCategory AS Field1,
        fldDescription AS Field2 From tbl2002Transact ions
        Data Mapping is (I think, but I claim no expertise here at all) a
        technical term referring to the sharing of data between disparate
        systems according to a set of specific rules; I'm not familiar with it
        in the context of ADO recordsets but perhaps I'm missing something.
        Searching ADO (2.8) help for Data Mapping brings up only minor and
        incidental references.

        Comment

        • corey lawson

          #5
          Re: Data mapping with a DAO.Recordset?

          Jozef wrote:
          [color=blue]
          > Hello,
          >
          > I was wondering, is it possible to add to a recordset? i.e. I create a DAO
          > recordset with information from one SQL statment, and add records from
          > another SQL statement (which grabs info from a different source). Similar
          > to data mapping. Is that possible?
          >
          > Thanks!
          >
          >[/color]

          Sure. But you have to do it field by field.

          Dim rs1 as dao.recordset
          dim rs2 as dao.recordset

          '<...stuff to open and filter recordsets...>

          rs1.movefirst
          while not rs1.EOF
          'assuming that rs2 has already been filtered, etc.
          while not rs2.EOF
          rs1.AddNew
          rs1!field1.valu e = rs2!fieldX.valu e
          rs1!field2.valu e = rs2!fieldY.valu e
          '...
          rs1.update
          rs2.movenext
          wend
          wend

          Comment

          Working...