473,386 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

me.Bookmark is undefined

Over the years I had a problem where me.Bookmark in an open form was
undefined until I closed and reopened the form. The problem was caused by an
old dialog form that set an object variable to the current database then on
form close, used the Close method on that variable.

The following code was used during form open

Set WS = DBEngine.Workspaces(0)
Set DB1 = WS.Databases(0)

Was used at form close
DB1.Close ' This kills me.Bookmark for any open form
WS.Close

Should have been
Set DB1 = Nothing
Set WS = Nothing

This show the affect of closing something I did not open.
Apr 6 '07 #1
1 2191
Yes, this is a real issue, though it's actually your bug and not
Microsoft's.

When you start Access, the dbEngine object is opened, along with the default
workspace and database. Your code is not creating Workspaces(0) - you are
merely pointing your variable to the default workspace that is already open.

Since you did not open it, you should not close it. If you do close it,
Access obeys your instructions and closes the workspace. It gives no error:
in fact Microsoft is too kind because they merely create the default
workspace again (along with the default database that depends on it), and
things keep running.

However, the RecordsetClone of a form relies on *another* database -
typically Databases(1). This one does not get automatically recreated. So a
side effect of closing the default workspace is that the database
connections being used by the RecordsetClone of your forms is terminated and
not automatically recreated for you. But when you open a new form (or close
and reopen it), the clone set becomes available as normal.

So in short, the form's RecordsetClone was dependent on Workspaces(0), which
you closed. And the moral of the story is: close what you open, but *only*
what you open.

This issue is trap #3 in this article about transactions:
Archive: Move Records to Another Table
at:
http://allenbrowne.com/ser-37.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"paii, Ron" <pa**@packairinc.comwrote in message
news:DL******************************@athenet.net. ..
Over the years I had a problem where me.Bookmark in an open form was
undefined until I closed and reopened the form. The problem was caused by
an
old dialog form that set an object variable to the current database then
on
form close, used the Close method on that variable.

The following code was used during form open

Set WS = DBEngine.Workspaces(0)
Set DB1 = WS.Databases(0)

Was used at form close
DB1.Close ' This kills me.Bookmark for any open form
WS.Close

Should have been
Set DB1 = Nothing
Set WS = Nothing

This show the affect of closing something I did not open.
Apr 7 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bookmark | last post by:
I have a form that does a few things, such as collect data and than using cdonts emails this data to a place to be parsed. I need to add a bookmark command to this form. I have a javascript...
17
by: Danny J. Lesandrini | last post by:
The following code works with a standard MDB to navigate to a particluar record (with a DAO recordset, of course) but it's giving me problems in an ADP I'm working on. Dim rs As ADODB.Recordset...
2
by: Thelma Lubkin | last post by:
With Me!PERSONSLIST.Form.RecordsetClone .FindFirst strID If .NoMatch Then Debug.Print "key " & Key & " nomatch" Exit Sub Else If Me.Dirty Then Me.Dirty = False Debug.Print "A_LOAD bookmark = "...
6
by: Chris | last post by:
I have been learning C and want to write a program and need someone to point me in the write direction. I want to write a program to store all my webpage bookmarks in possibly one file. I want it...
2
by: Alan T | last post by:
How do I make use of the Bookmarks property so that I can write a text at/below the position of a particular bookmark or the first bookmark ? private Microsoft.Office.Interop.Word.Document...
0
by: Alan T | last post by:
My code can select the content of a Word document between 2 bookmarks: if (bookmarks.Exists("first bookmark") & bookmarks.Exists("second bookmark")) { object oFirstBookmark = ("first...
4
by: zzapper | last post by:
Hi, I use an internal bookmark <form method="post" action="${form_action}#mark1"> to return to the correct place in the page. In case of an error I would wish to return to the top of the...
11
by: Tom Clavel | last post by:
I need to make sure that I am on a different record than I just was on, in a DAO recordset. code fragment: 1. strFind = "thisSource = " & tripID & " AND thisTrip = " & tripID 2. ...
0
by: JosAH | last post by:
Greetings, Introduction At this moment we have a TextProcessor, a LibraryBuilder as well as the Library itself. As you read last week a Library is capable of producing pieces of text in a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.