Welcome to SPN

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

Sign Up Now!
  1. Guest ji, please consider donating today!
      Become a Supporter    ::   Make a Contribution   
    Monthly Recurring Target: $300 :: Achieved: $95

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!
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page