Solved

Not a valid bookmark error

Posted on 2007-12-03
8
2,371 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
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.  

 
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

717 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