CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2001
    Location
    Israel
    Posts
    2

    Getting data from the latest Access record

    Hi everyone,
    I need some help with MS Access.
    I need to get information from a specific field in the latest record (to write it in some textbox), and then in a new record write some data to the same field.
    I tried to get the last record by using "movelast" function and then, in the new record I opened I wrote the information.
    but what accually happent is that the data I wanted to write in the new record was writen down both in the new record and the latest one (deleting previous data in that field).
    I hope someone can help me.... I'm wasting a lot of time on this thing....
    thanks, Shiry



  2. #2
    Join Date
    Jan 2001
    Posts
    22

    Re: Getting data from the latest Access record

    Use movelast method to get to your last record...
    then assing the data you want to transfer down into variables..
    then use rs.AddNew method to make a new record.
    rs will be pointing to the new record.
    rs.fields("fieldname1") = variable1
    rs.fields("fieldname2") = newvalue2
    etc.
    '

    when done,
    rs.update will add the new record to your database.



    Hope this helps and
    May the Force be with you.



  3. #3
    Join Date
    Aug 2000
    Location
    NY, USA
    Posts
    632

    Re: Getting data from the latest Access record

    Do you use Data Bound Controls? If so, when you add a new record, you are leaving the last one and the last one gets update from Data Bound control.
    Vlad


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