Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2007
    Global Village

    Question Unanswered: How to Add New Fields to Recordset?

    Hi Everybody,
    I actually wrote a code in ADO method and made a recordset for data source of a chart but I need to add two new fields to this recordset and add some calculations to them.
    in first step I made the Recordset disconnected by setting the connection to nothing then I use the following code but It doesn’t function:

    With RST
    .Fields.Append "newfield1", adInteger, 10, adFldUpdatable
    End with

    Appreciate any Help or any New Idea

  2. #2
    Join Date
    Apr 2003
    Alabama, USA
    I think you can't do it with an open ADO recordset but don't quote me on that, don't use ADO all that much. See PRB: Appending Fields to a Recordset Generates an Error

    Here's how to do it using DAO
        Dim db As DAO.Database
        Dim tdf As DAO.TableDef
        Set db = CurrentDb()
        Set tdf = db.TableDefs("tblData")
        With tdf
            .Fields.Append .CreateField("newfield1", dbInteger)
        End With
    This might be helpful but it's more of how to use SQL statements. - Microsoft Access : DDL Examples

    You live and learn. At any rate, you live. - Douglas Adams

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts