473,396 Members | 1,804 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,396 software developers and data experts.

A2003 Slow in Shuting Down BE ldb

I'm having a vexing problem with using filecopy and compactdatabase on a
Jet back end I'm sure I did not have with A97. It seems to me that
A2003 is much slower in shutting down the back end ldb than A97 and the
code below (for compactdatabase) gets caught and throws an error related
to the BE still being open.

I would really appreciate any suggestions. I first ran into this with
FileCopy and settled on a warning to close all forms first and then the
user has to again choose a menu item to do the function.

Here's the code. I leave out the code for the fGetLinkPath function
which I believe I got from the Access Web & Dev Ashish. I do include
the fCloseAll function (closes open forms) and the actual function
performing the compact. The error is thrown at the line
"CompactDatabase strNew, strCompact" in the last function below and
indicates the back end is still open:

Function fCompactBe()

Dim strPath As String

If MsgBox("This will close all screens and optimize (compact) your
data file" & vbCrLf & vbCrLf & _
"Continue?", vbQuestion + vbOKCancel, "Shut Down and Optimize
Data File?") = vbCancel Then GoTo Exit_Proc

fCloseAll

strPath = fGetLinkPath("TBL_GAME")

fCompactDataFile strPath

DoCmd.OpenForm "frmsetup", acNormal

Exit_Proc:

Exit Function

End Function

Function fCloseAll() As Boolean

'Closes all forms, getting rid of any connections
'to the back end

Do While Access.Forms.Count > 0

DoCmd.Close acForm, Forms(0).Name

Loop

End Function

Function fCompactDataFile(strNew As String)

'strNew is path to back end

Dim strCompact As String

'first designate strCompact as the newpath with a wierdname:

strCompact = Left(strNew, (Len(strNew) - 3)) & "_COMPACT.mdb"
'renames whatever.mdb to whatever_COMPACT.mdb

CompactDatabase strNew, strCompact

FileCopy strCompact, strNew 'copy over new file with successfully
compacted one

Kill strCompact

End Function
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #1
3 1597
Have you tried DBEngine.Idle before trying to copy the file?

On Sun, 30 Jan 2005 21:55:55 -0330, Tim Marshall
<TI****@PurplePandaChasers.Moertherium> wrote:
I'm having a vexing problem with using filecopy and compactdatabase on a
Jet back end I'm sure I did not have with A97. It seems to me that
A2003 is much slower in shutting down the back end ldb than A97 and the
code below (for compactdatabase) gets caught and throws an error related
to the BE still being open.

I would really appreciate any suggestions. I first ran into this with
FileCopy and settled on a warning to close all forms first and then the
user has to again choose a menu item to do the function.

Here's the code. I leave out the code for the fGetLinkPath function
which I believe I got from the Access Web & Dev Ashish. I do include
the fCloseAll function (closes open forms) and the actual function
performing the compact. The error is thrown at the line
"CompactDatabase strNew, strCompact" in the last function below and
indicates the back end is still open:

Function fCompactBe()

Dim strPath As String

If MsgBox("This will close all screens and optimize (compact) your
data file" & vbCrLf & vbCrLf & _
"Continue?", vbQuestion + vbOKCancel, "Shut Down and Optimize
Data File?") = vbCancel Then GoTo Exit_Proc

fCloseAll

strPath = fGetLinkPath("TBL_GAME")

fCompactDataFile strPath

DoCmd.OpenForm "frmsetup", acNormal

Exit_Proc:

Exit Function

End Function

Function fCloseAll() As Boolean

'Closes all forms, getting rid of any connections
'to the back end

Do While Access.Forms.Count > 0

DoCmd.Close acForm, Forms(0).Name

Loop

End Function

Function fCompactDataFile(strNew As String)

'strNew is path to back end

Dim strCompact As String

'first designate strCompact as the newpath with a wierdname:

strCompact = Left(strNew, (Len(strNew) - 3)) & "_COMPACT.mdb"
'renames whatever.mdb to whatever_COMPACT.mdb

CompactDatabase strNew, strCompact

FileCopy strCompact, strNew 'copy over new file with successfully
compacted one

Kill strCompact

End Function


Nov 13 '05 #2
Steve Jorgensen wrote:
Have you tried DBEngine.Idle before trying to copy the file?


Thanks, Steve, no I haven't - I've never heard of this... I'll see what
I can find in help.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #3
Steve Jorgensen wrote:
Have you tried DBEngine.Idle before trying to copy the file?


No, that did not work. 8( I tried

Access DBEngine.Idle (bothe with and without dbRefreshCache)

in front of the compactdatabase command and also immediately after the
function which closes forms and I still threw 3356 "you attempted to
open a database that is already opened exclusively by user 'ADMIN' on
machine '<my machine name>'. Try agains when the database is available."

This is a single user app, as well, not a multi user. The back end will
most likely always be on the same machine.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #4

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

Similar topics

12
by: Neil | last post by:
I previously posted re. this, but thought I'd try again with a summary of facts. I have an Access 2000 MDB with a SQL Server 7 back end. There is a view that is linked to the database via ODBC...
0
by: Tim Marshall | last post by:
I'm "exploring" A2003 right now and am pretty frustrated (Up until now, I've been an A97 only user). The improved security feature which interrogates the user as to whether s/he wants to open an...
6
by: paulwilliamsonremove | last post by:
Hi, I have two queries: "qryHistoryPersonIDs" that just contains the "personID" numeric field, and "qryDonations" that just contains the "personID" field, and a date field ("dDonationDate"). ...
17
by: rdemyan via AccessMonster.com | last post by:
With A2003, I'm having trouble accessing files in a folder on another computer where back-end files, update files, etc are located. Here's the scenario: 1) Computer #1 - A2003 2) Computer #2 -...
4
by: Frank | last post by:
My program gets a WM_QUERYENDSESSION message and asks the user if it is OK to shutdown. While he's thinking about it, Windows displays a box saying the program is not responding, and if not...
1
by: Sebouh | last post by:
Hi guys. I''m curious about what happens when windows shuts down. I have a program running that saves data into a file when the form's closing method is invoked. So when Windows shuts down, does...
7
by: Salad | last post by:
I am converting an application from A97 to A2003. I have 2 tables created by another application as a Foxpro.dbf. The table has no index. The connect string in A97 is FoxPro...
5
by: drexlin | last post by:
We have an application that is supposed to run as a service. When someone shuts down the computer, the app is supposed to save the contents of the screen into a file so it can be loaded back up when...
3
by: Salad | last post by:
I am using A2003, SP3. If I use the QueryBuilder and select a table and drag the fields to it and then select Query/Append from the menu as the type of query, the first table name (alphabetically)...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.