?
Solved

Not a valid bookmark error

Posted on 2007-12-03
8
Medium Priority
?
2,411 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 132 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 132 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 20

Assisted Solution

by:clarkscott
clarkscott earned 136 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 1600 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

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

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