Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Adding to a recordset

Discussion in 'Information Technology' started by James, Jul 28, 2006.

  1. James

    James
    Expand Collapse
    Guest

    I'm trying to run through a recordset (rs) and create a new one
    (OfferingsDuplicate) off of that one. It errors out on the .AddNew with
    error "Operation is not allowed when the object is closed"

    Here's my code:

    Set DuplicateOfferings = New Recordset
    Do While Not rs.EOF

    If Not IsNull(rs.Fields("Link")) Then
    If rs.Fields("Link") <> "" Then
    If rs.Fields("Link") <> 0 Then

    DO_Link = rs.Fields("Link")

    With DuplicateOfferings
    .AddNew (DO_Link)
    .update
    End With

    DO_OfferingID = rs.Fields("OfferingID")

    With DuplicateOfferings
    .AddNew (DO_OfferingID)
    .update
    End With


    End If
    End If
    End If


    rs.MoveNext
    Loop


    Thanks!
     
  2. James

    James
    Expand Collapse
    Guest

    My recordset has no fields in it.... how do I add a field "Parent" and
    "Child" and then add data to those fields? Sorry I don't really know
    what I'm doing. Thanks a lot!
    James wrote:
    > I'm trying to run through a recordset (rs) and create a new one
    > (OfferingsDuplicate) off of that one. It errors out on the .AddNew with
    > error "Operation is not allowed when the object is closed"
    >
    > Here's my code:
    >
    > Set DuplicateOfferings = New Recordset
    > Do While Not rs.EOF
    >
    > If Not IsNull(rs.Fields("Link")) Then
    > If rs.Fields("Link") <> "" Then
    > If rs.Fields("Link") <> 0 Then
    >
    > DO_Link = rs.Fields("Link")
    >
    > With DuplicateOfferings
    > .AddNew (DO_Link)
    > .update
    > End With
    >
    > DO_OfferingID = rs.Fields("OfferingID")
    >
    > With DuplicateOfferings
    > .AddNew (DO_OfferingID)
    > .update
    > End With
    >
    >
    > End If
    > End If
    > End If
    >
    >
    > rs.MoveNext
    > Loop
    >
    >
    > Thanks!
     
  3. James

    James
    Expand Collapse
    Guest

    never mind... i'm gonna try it a different way.
    James wrote:
    > My recordset has no fields in it.... how do I add a field "Parent" and
    > "Child" and then add data to those fields? Sorry I don't really know
    > what I'm doing. Thanks a lot!
    > James wrote:
    > > I'm trying to run through a recordset (rs) and create a new one
    > > (OfferingsDuplicate) off of that one. It errors out on the .AddNew with
    > > error "Operation is not allowed when the object is closed"
    > >
    > > Here's my code:
    > >
    > > Set DuplicateOfferings = New Recordset
    > > Do While Not rs.EOF
    > >
    > > If Not IsNull(rs.Fields("Link")) Then
    > > If rs.Fields("Link") <> "" Then
    > > If rs.Fields("Link") <> 0 Then
    > >
    > > DO_Link = rs.Fields("Link")
    > >
    > > With DuplicateOfferings
    > > .AddNew (DO_Link)
    > > .update
    > > End With
    > >
    > > DO_OfferingID = rs.Fields("OfferingID")
    > >
    > > With DuplicateOfferings
    > > .AddNew (DO_OfferingID)
    > > .update
    > > End With
    > >
    > >
    > > End If
    > > End If
    > > End If
    > >
    > >
    > > rs.MoveNext
    > > Loop
    > >
    > >
    > > Thanks!
     

Share This Page