Not a Valid Bookmark

C

CrystalJim

Network OS = w2003, desktop = XPPro, Access = 2003

Database #1, using all access tables and queries, uses the same code as DB
#2 to find a record.
DB #2 is linked to 4 SQL tables, and has 3 access queries, one of which is
used by the main form.
DB # 1 works when doing a record search.

DB#2 using the same code (Copied from DB#1), fails with the "Not a valid
bookmark error" message. I have compacted and repaired several times.
Started with the decompile switch - did not fix.
rsObject.Supports(adBookmark) = true

Here is the code:

Set cnObject = New ADODB.Connection
Set rsObject = New ADODB.Recordset

cnObject.Open "provider = microsoft.jet.oledb.4.0; " & _
"data source = J:\tasks\modelnumberconversion.mdb; "
rsObject.CursorLocation = adUseClient
rsObject.Open "qryModelNumbers", cnObject, adOpenKeyset, adLockOptimistic,
adCmdTable

rsObject.Filter = strWhereClause

If rsObject.EOF = True Then
MsgBox "Name Not found, Please check your spelling and try again."
Exit Sub
Else
Me.Bookmark = rsObject.Bookmark --- Fails here
End If

Except for the path to the database and variable names, the code in DB#1 is
the same as DB#2.
Using the Edit/Find Menu does work but is not what the end user wants - and
when the end user is your boss, well...

What am I missing?
 
D

Dave Patrick

The table data is probably corrupt due to no primary key. The DB engine
can't differentiate between two identical rows.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| Network OS = w2003, desktop = XPPro, Access = 2003
|
| Database #1, using all access tables and queries, uses the same code as DB
| #2 to find a record.
| DB #2 is linked to 4 SQL tables, and has 3 access queries, one of which is
| used by the main form.
| DB # 1 works when doing a record search.
|
| DB#2 using the same code (Copied from DB#1), fails with the "Not a valid
| bookmark error" message. I have compacted and repaired several times.
| Started with the decompile switch - did not fix.
| rsObject.Supports(adBookmark) = true
|
| Here is the code:
|
| Set cnObject = New ADODB.Connection
| Set rsObject = New ADODB.Recordset
|
| cnObject.Open "provider = microsoft.jet.oledb.4.0; " & _
| "data source = J:\tasks\modelnumberconversion.mdb; "
| rsObject.CursorLocation = adUseClient
| rsObject.Open "qryModelNumbers", cnObject, adOpenKeyset, adLockOptimistic,
| adCmdTable
|
| rsObject.Filter = strWhereClause
|
| If rsObject.EOF = True Then
| MsgBox "Name Not found, Please check your spelling and try again."
| Exit Sub
| Else
| Me.Bookmark = rsObject.Bookmark --- Fails here
| End If
|
| Except for the path to the database and variable names, the code in DB#1
is
| the same as DB#2.
| Using the Edit/Find Menu does work but is not what the end user wants -
and
| when the end user is your boss, well...
|
| What am I missing?
|
| --
| Jim
 
B

Brendan Reynolds

I'm not sure if this is the cause of your problem, but the name
'qryModelNumbers' suggests that the source is a query, while the use of the
'acCmdTable' keyword is telling ADO that the source is a table. If the
source is, indeed, a query, then the correct option is adCmdStoredProc.
 
C

CrystalJim

Thanks for the suggestions.

Have primary key and have no identical rows.

Running lookup on an Access Query (aka "View" in SQL Server speak). The
form uses the same Access Query and has no issues.

Thanks again,

Jim
 
C

CrystalJim

Thanks for the suggestion.

Made the change - still get "Invalid Bookmark" error.

qryModelNumbers is an Access query ("View" in SQL Server) with data from 4
SQL Server Tables.

No issues using a Query/View if the source tables are Access tables. No
other issues (so far) using the Query/View. Form is fully functional.

Oh well, thanks again,

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top