Solved

Not a valid bookmark error

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

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best way to create dynamic, short cut menu 7 28
Access check if a table is open 4 42
MS Access from Delphi 31 29
Switch 5 17
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 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