Compact in Windows 98 vs Windows 2000

G

Guest

I have a split database and want to compact my backend from the front end.
When I run the following code on a Windows 2000 machine, it seems to work
just fine. When I put the db on a Windows 98 machine and run the same code,
it always errors out. Can anyone tell me why and if this can be made to run
on W98?? The db was created using Access 2000. Thanks for any help!

Code:
-----------------------------------------------------------------------------
Function CompactRepairDB(DBSourceName As String) As Boolean
Dim DbDestName As String

DbDestName = Left(DBSourceName, Len(DBSourceName) - 3) & "NEW"
DBEngine.CompactDatabase DBSourceName, DbDestName
Kill DBSourceName
Name DbDestName As DBSourceName
CompactRepairDB= True

End Function

I've also tried:
Public Sub CompactDB()

CommandBars("Menu Bar"). _
Controls("Tools"). _
Controls("Database utilities"). _
Controls("Compact and repair database..."). _
accDoDefaultAction

End Sub
 
W

Wayne Morgan

What is the error? Can you do the compact manually from the Win98 computer?
Right off-hand, I would suspect share or NTFS permissions on the "server"
computer and the account on the Win98 computer.
 
G

Guest

The W98 machine is a stand-alone system- not on a network at all. It also
just has Access Runtime installed - not the full version - running an .MDE.
Error is: 3356- "You attempted to open a database that is already opened
exclusively by user 'Admin' on machine 'XYZ'.

I know the Tools>Options>Advanced property for "Default Open Mode" is set to
= "Shared". This db compacts fine on a Windows 2000 machine??
Thanks for any ideas.
 
W

Wayne Morgan

So, I understand that the back-end is also located on the Win98 machine
since the computer isn't networked. The file has to be opened for exclusive
access in order to compact it. If you're running the code in the front-end,
it may be that the front-end already has the file open. If not, see if there
is an .ldb file with the same name as the back-end in the directory that the
back-end is in. If this file was left over (shouldn't have been, but does
happen) from have the file open previously, it may prevent the compact. If
the file is there and the back-end isn't open, you may delete the .ldb file.
 
G

Guest

What can you do if the front end has the back-end already open??
And why is this a problem on W98 and not W2000?
 
W

Wayne Morgan

The different operating systems and file systems handle open files
differently. Also, the settings may be different between the two computers
(i.e. Default Open Mode). There may also be a patch level difference. Have
you installed all Office and Jet patches for both computers? If you don't
see the Jet updates on Windows Update, you can find them here
http://msdn.microsoft.com/data/downloads/updates/default.aspx. To check the
version of Jet, check the version of Msjet40.dll in the %windir%\System32 or
%windir%\System directory (Win2k/Win98). To check the file version, right
click the file in Explorer, choose Properties, and go to the Version tab. To
see dll files, you may need to change your folder view settings in Explorer.
In Win98, this would be under the View menu in Explorer. Choose Folder
Options...|View tab and under Hidden files choose "Show all files". Compare
the version between the two computers.

Another thing to remember, is that the back-end file, although opened by the
front-end, is not the currently open database; the front-end is. So when you
use the Toolbars method you mentioned, you would compact the front-end.

You can find an example of compacting the back-end here.
http://www.rogersaccesslibrary.com/download3.asp?SampleName=CompactBackEndDB.mdb
 
G

Guest

Thanks for the input, Wayne. I'll check the file versions and see if that's
the problem. I appreciate your help!
 

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