?
Solved

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

Posted on 2005-03-03
7
Medium Priority
?
715 Views
Last Modified: 2012-06-27
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
Comment
Question by:newyuppie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 8

Expert Comment

by:ampapa
ID: 13450791
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
 
LVL 8

Accepted Solution

by:
ampapa earned 2000 total points
ID: 13450821
0
 
LVL 14

Expert Comment

by:aelatik
ID: 13450973
You start with .ADDNEW and end it with .UPDATE ( .MOVENEXT is only for iteration through the recordset, not with insert )
0
Independent Software Vendors: 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!

 
LVL 13

Author Comment

by:newyuppie
ID: 13450975
am using JET, why can't i open the recordset with Optimisitic lock and Dynamic cursor?
0
 
LVL 8

Expert Comment

by:ampapa
ID: 13452249
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
 
LVL 13

Author Comment

by:newyuppie
ID: 13461282
thank you for the links ampapa, will dig further into it.
0
 
LVL 8

Expert Comment

by:ampapa
ID: 13461869
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 16 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question