Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...love the site and am constantly recommending it to (selected !) clients here in ireland..."

Geography

Where in the world do Tek-Tips members come from?
robojeff (TechnicalUser)
10 Jul 12 9:23



I am attempting to add a new record to a table and I am able to access the table OK and move to the last record with .MoveLast

But then I add a new record with .AddNew and the record appears in the table but when I attempt to edit that record, I find that I am not indexing the new record but the last record so I added another .MoveLast but this does not select the new record for me to update.

how do I add a new record to the end of the table and then select the new record to update it?

thank you

CODE -->

Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset, dbAppendOnly)

     If rst.EOF = False Or rst.BOF = False Then
        rst.MoveLast
        rst.AddNew
        rst.MoveLast
        With rst
            .Edit
            !Assembly = Me.Asm
            .Update
        End With
        rst.close    ' Close the recordset.
   
        Set rst = Nothing
        Set dbs = Nothing
    End If 
robojeff (TechnicalUser)
10 Jul 12 9:45

Problem solved...

I changed the following:

CODE -->

If rst.EOF = False Or rst.BOF = False Then
        rst.MoveLast

        With rst
           .AddNew
           .Update
           .MoveLast
        
           .Edit 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close