Solved

Not a valid bookmark error

Posted on 2007-12-03
8
2,341 Views
Last Modified: 2013-11-29
Hello,
I have created recordset RecipesRS and would like to bookmark the record previous to the one showing on the unbound form:
Dim varBookmark As Variant
Set RecipesRS = db.OpenRecordset("SELECT " & strTableName & ".* FROM " & strTableName & " ORDER BY " & strTableName & ".txtCourse;", dbOpenDynaset)
'The user can scrolll through the recordset in a form.
****************
'This is the part that doesn't work:
RecipesRS.MovePrevious
varBookmark = RecipesRS.Bookmark

I get run-time error '3159': Not a valid bookmark.
Does anyone know what I'm doing wrong?
Thank you.
Saleve
0
Comment
Question by:Saleve
[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
8 Comments
 
LVL 46

Assisted Solution

by:tbsgadi
tbsgadi earned 33 total points
ID: 20395242
Hi Saleve,

Try something like Forms![frmMain].Bookmark = RecipesRS.Bookmark

Good Luck!

Gary
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 20395247
Saleve,


Or Alternatively maybe Dim varBookmark as object

Gary
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 33 total points
ID: 20395267
There doesn't seem to be any code that aligns the recordset with the record that is visible on the form?
0
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!

 
LVL 20

Assisted Solution

by:clarkscott
clarkscott earned 34 total points
ID: 20395283
Your error is occuring on the first record returned from your query.
There is no PREVIOUS record therefore no bookmark can be made.

Scott c
0
 
LVL 16

Accepted Solution

by:
Rick_Rickards earned 400 total points
ID: 20395315
If you want to move your form to the prevoius record the code would look something like this...
Dim rst as DAO.Recordset
Set rst = Me.RecordsetClone
rst.BookMark = Me.Bookmark
If rst.BOF = False then rst.MovePrevious
Me.BookMark = rst.BookMark
Set rst = Nothing

Open in new window

0
 

Author Comment

by:Saleve
ID: 20398240
Hello everyone and thank you for your input.  I will be away for a few days and will look at this as soon as I get back.  I apologize in advance for the delay in assigning points.
Saleve
0
 

Author Comment

by:Saleve
ID: 20521728
My sincere apologies for the delay.  Ive been out of town&  Thank you for your answers and patience!
0
 

Author Closing Comment

by:Saleve
ID: 31412310
I actually have code to fill in the fields on the form, as well as to deal with the first record, but thanks for the input.  The accepted solution works for the second record in the recordset ONLY, so I guess my problems go deeper than just this issue....
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

733 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