CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2001
    Location
    South Dakota
    Posts
    20

    .Absolute Position

    I have a code errors out telling me I have an invalid key. The code it errors on is as follows:

    Do While Not rs.EOF

    .Add rs.AbsolutePosition + 1, rs!Site_Number, rs!Site_Number
    rs.MoveNext
    Loop

    (it errors at the .ADD rs line)
    I can't find any help on the invalid key error. Anyone have any suggestions?
    Thanks
    Pat


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: .Absolute Position

    .Add rs.AbsolutePosition + 1, rs!Site_Number, rs!Site_Number
    First of all I never heard about .Add statement (maybe it is my problem). As far as I know only AddNew exists. If youare trying to add a new record you have to consider 2 things
    1.AbsolutePosition not always gives you the accurate record number
    2. AddNew always add a new record at the end of the recordset

    If that is what you are trying to accomplish the syntax is

    with rs
    .AddNew
    !Field1 = ...
    !Field2 = ...
    .Update
    end with

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured