Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 718
  • Last Modified:

.movenext when not .eof returns "bookmark is invalid"

using microsoft ADO 2.8 in excel VBA, i open a recordset which i want to add records.
currently using
.cursortype = adOpenDynamic
.LockType = adLockOptimistic

i get the error in the line marked with *

                            .AddNew
                            !mp = h
                            .Update
       *                   .MoveNext

anyway, if i debug and debug.print the cursortype, it says "1", which i think means adOpenKeySet, right? what is wrong about my code and how is it supposed to be?
0
newyuppie
Asked:
newyuppie
  • 4
  • 2
1 Solution
 
ampapaCommented:
I'm probably wrong here but I'm not sure you need to .movenext when adding a new record? There isn't a record to move to. Have you tried commenting that out and re-running to add records?
0
 
aelatikCommented:
You start with .ADDNEW and end it with .UPDATE ( .MOVENEXT is only for iteration through the recordset, not with insert )
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
newyuppieAuthor Commented:
am using JET, why can't i open the recordset with Optimisitic lock and Dynamic cursor?
0
 
ampapaCommented:
What does the connect string, etc. look like?

Here is an example of a connection and recordset operation.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdconusingrecordsetobj.asp
0
 
newyuppieAuthor Commented:
thank you for the links ampapa, will dig further into it.
0
 
ampapaCommented:
Glad I could help. Thanks for the grade.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now