Access is noted for bloating a database when you add and delete records
frequently. I have always had mine set to compact on close, and that works
great. Now after everyone's advice I split my database, so the data is in
a second (back-end) database with all the tables linked. However, now when
I close the database, it compacts the front end, since that's what's open,
and the back-end grows.
I now have to manually open and close the back-end seperately just to
compact it.
Surely there is a better way?
Thanks,
Larry L 13 10390
On Wed, 07 Jan 2004 09:33:59 GMT, la***@somewhereinhawaii.net (Larry L) wrote: Access is noted for bloating a database when you add and delete records frequently. I have always had mine set to compact on close, and that works great. Now after everyone's advice I split my database, so the data is in a second (back-end) database with all the tables linked. However, now when I close the database, it compacts the front end, since that's what's open, and the back-end grows.
I now have to manually open and close the back-end seperately just to compact it.
Surely there is a better way?
Thanks, Larry L
Well, it's not just the bloating. You need to compact the database from time
to time to optimize the table indexes, and clean up nascent corruption before
it presents symptoms.
Yes, with a split front-back end database, you need a way to periodically
compact the database, and you can automate that by running Access with the
/compact parameter. See "Startup command-line options" in the Access help for
details.
"Steve Jorgensen" <no****@nospam.nospam> escreveu na mensagem
news:do********************************@4ax.com... On Wed, 07 Jan 2004 09:33:59 GMT, la***@somewhereinhawaii.net (Larry L)
wrote:Access is noted for bloating a database when you add and delete records frequently. I have always had mine set to compact on close, and that
worksgreat. Now after everyone's advice I split my database, so the data is in a second (back-end) database with all the tables linked. However, now
whenI close the database, it compacts the front end, since that's what's
open,and the back-end grows.
I now have to manually open and close the back-end seperately just to compact it.
Surely there is a better way?
Thanks, Larry L Well, it's not just the bloating. You need to compact the database from
time to time to optimize the table indexes, and clean up nascent corruption
before it presents symptoms.
Yes, with a split front-back end database, you need a way to periodically compact the database, and you can automate that by running Access with the /compact parameter. See "Startup command-line options" in the Access help
for details.
another nice "CDMA" solution to compact BE from te Front End:
(notice word wrap) http://groups.google.com/groups?hl=p...254024.9.0.131
Roberto
In article <do********************************@4ax.com>, Steve Jorgensen <no****@nospam.nospam> wrote: On Wed, 07 Jan 2004 09:33:59 GMT, la***@somewhereinhawaii.net (Larry L) wrote:
Access is noted for bloating a database when you add and delete records frequently. I have always had mine set to compact on close, and that works great. Now after everyone's advice I split my database, so the data is in a second (back-end) database with all the tables linked. However, now when I close the database, it compacts the front end, since that's what's open, and the back-end grows.
I now have to manually open and close the back-end seperately just to compact it.
Surely there is a better way?
Thanks, Larry L
Well, it's not just the bloating. You need to compact the database from time to time to optimize the table indexes, and clean up nascent corruption before it presents symptoms.
Yes, with a split front-back end database, you need a way to periodically compact the database, and you can automate that by running Access with the /compact parameter. See "Startup command-line options" in the Access help for details.
Steve,
Thanks, but I tried adding that switch, using this syntax:
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"
"District Database.mdb" "/compact"
and got an error message that it wasn't supported. So I looked it up, and
it says that it opens the specified database, compacts it, and then closes
it. Even if it works, that's not what I need. I just want to compact the
Back-End, in some automated way, without running some other command. Any
other ideas?
Larry L
In article <bt************@ID-66191.news.uni-berlin.de>, "Roberto Spier" <fo*****@invalid.com> wrote: another nice "CDMA" solution to compact BE from te Front End:
(notice word wrap) http://groups.google.com/groups?hl=p...dm=Xns907570C9 Alylefairyahoocom%4024.9.0.131&rnum=1&prev=/groups%3Fhl%3Dpt%26lr%3D%26ie%3DUTF -8%26safe%3Doff%26selm%3DXns907570C9Alylefairyahooc om%254024.9.0.131
Roberto
Roberto,
Thanks, but while that looks nice, it doesn't work fo me. It goes to the
error that the "Database seems to be opened by another user". I don't know
how to "close" it without unlinking the tables, and that just creates
other problems.
Has anyone ever actually tried this code? Am I just missing something?
Thanks,
Larry L
"Larry L" <la***@somewhereinhawaii.net> wrote in message
news:Sd*******************@twister.socal.rr.com... In article <bt************@ID-66191.news.uni-berlin.de>, "Roberto Spier"
<fo*****@invalid.com> wrote: Thanks, but while that looks nice, it doesn't work fo me. It goes to the error that the "Database seems to be opened by another user". I don't know how to "close" it without unlinking the tables, and that just creates other problems.
Has anyone ever actually tried this code? Am I just missing something?
I've never tried the code, but the links by themselves don't cause the back end
file to be "in use" unless your front end is actually doing something with them.
As long as you close all forms and recordsets that use the links then you
should be able to compact the back end from the front end.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
This may seem convoluted, but I haven't built too many databases. That
said, it works quite well for my needs.
I have a separate maintenance database, originally created to run backups of
the tables in my backend on interval. I created a table in this db to also
manage a compact routine that stores planned start and stop dates/times for
"scheduled maintenance." I have an always-open form in the front end that
periodically compares Now with the planned start time of the next possible
maintenance window. 10 minutes before the planned start time, current users
will be forced to shut down and no users will be allowed to log in.
When the maintenance database is opened, a module runs that checks for a
passed command line. If it's told to compact, it will:
- check for no LDB
- create a backup copy of the backend, and save it in a nice place
- open the backend exclusively and compact to a temp location
- check for the temp, compacted backend
- if it's there, copy it over the original backend
An error along the way triggers an email to me using COM. Once complete,
regardless of outcome, a new record is created recording the next planned
outage, at the interval of my choice - I do this weekly...maybe that's
overkill. Knowing the planned start, the module then schedules a task
within Windows Task Scheduler that will open the maintenance database at
that time, passing the compact argument. You can get the dll that makes
writing a task a breeze at: http://www.mtogden.com/~tom/files/Sc...ngAgentVB6.zip
I probably couldn't have accomplished it without the help of this group.
Hope this gives you some ideas.
"Larry L" <la***@somewhereinhawaii.net> wrote in message
news:W9*******************@twister.socal.rr.com... In article <do********************************@4ax.com>, Steve Jorgensen
<no****@nospam.nospam> wrote: On Wed, 07 Jan 2004 09:33:59 GMT, la***@somewhereinhawaii.net (Larry L)
wrote:Access is noted for bloating a database when you add and delete records frequently. I have always had mine set to compact on close, and that
worksgreat. Now after everyone's advice I split my database, so the data is
ina second (back-end) database with all the tables linked. However, now
whenI close the database, it compacts the front end, since that's what's
open,and the back-end grows.
I now have to manually open and close the back-end seperately just to compact it.
Surely there is a better way?
Thanks, Larry L
Well, it's not just the bloating. You need to compact the database from
timeto time to optimize the table indexes, and clean up nascent corruption
beforeit presents symptoms.
Yes, with a split front-back end database, you need a way to periodically compact the database, and you can automate that by running Access with
the/compact parameter. See "Startup command-line options" in the Access
help fordetails.
Steve,
Thanks, but I tried adding that switch, using this syntax:
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "District Database.mdb" "/compact"
and got an error message that it wasn't supported. So I looked it up, and it says that it opens the specified database, compacts it, and then closes it. Even if it works, that's not what I need. I just want to compact the Back-End, in some automated way, without running some other command. Any other ideas?
Larry L
"David W. Fenton" <dX********@bway.net.invalid> escreveu na mensagem
news:94***************************@24.168.128.78.. . fo*****@invalid.com (Roberto Spier) wrote in <bt************@ID-66191.news.uni-berlin.de>:
another nice "CDMA" solution to compact BE from te Front End:
(notice word wrap) http://groups.google.com/groups?hl=p...fe=off&threadm =Xns907570C9Alylefairyahoocom%4024.9.0.131&rnum=1 &prev=/groups%3Fhl %3Dpt%26lr%3D%26ie%3DUTF-8%26safe%3Doff%26selm%3DXns907570C9Alylefa iryahoocom%254024.9.0.131
An off-topic observation:
These Google URLs really only need one argument, the selm argument. So, this URL gets you to the same article:
http://groups.google.com/groups?selm...airyahoocom%40 24.9.0.131
The simplest way to get this URL is to view the article in original format and remove the &output=gplain argument.
Also, this will get you Google in your own language, whereas your URL was language-specific.
-- David W. Fenton http://www.bway.net/~dfenton dfenton at bway dot net http://www.bway.net/~dfassoc
It seemed messy, indeed! As a regular reader, I'd have notice it.
Got it. Thanks for the tip.
Roberto
"Rick Brandt" <ri*********@hotmail.com> escreveu na mensagem
news:bt************@ID-98015.news.uni-berlin.de...
I've never tried the code, but the links by themselves don't cause the
back end file to be "in use" unless your front end is actually doing something with
them. As long as you close all forms and recordsets that use the links then you should be able to compact the back end from the front end.
Right, but there is a typo in the original code that causes
CanBeOpenedExclusively() to always return false:
You need to correct the OpenDatabase argument list, adding an extra comma as
bellow:
Set d = P(0).OpenDatabase(FullPath, , True)
By the way, if this code will be run from an unbound form, this form needs
to be excluded from the code test "Forms.Count Or Reports.Count". Maybe
something like (air code)
Dim frm as Form
Dim openedForms as Integer
for each frm in Forms
openedForms = opendForms - ( frm.Name <> "our Unbound Form")
Next
If opendeForms > 0 Then
MsgBox "Please, close all forms and reports, and retry.", vbExclamation,
"FFDBA"
Else
...
End If
Hope my English makes sense!
Roberto
"Roberto Spier" <fo*****@invalid.com> wrote in
news:bt************@ID-66191.news.uni-berlin.de: "Rick Brandt" <ri*********@hotmail.com> escreveu na mensagem news:bt************@ID-98015.news.uni-berlin.de...
I've never tried the code, but the links by themselves don't cause the
back end file to be "in use" unless your front end is actually doing something with them. As long as you close all forms and recordsets that use the links then you should be able to compact the back end from the front end.
Right, but there is a typo in the original code that causes CanBeOpenedExclusively() to always return false:
You need to correct the OpenDatabase argument list, adding an extra comma as bellow:
Set d = P(0).OpenDatabase(FullPath, , True)
form the help file
**** begin quote ****
OpenDatabase Method
Opens a specified database in a Workspace object and returns a reference
to the Database object that represents it.
Syntax
Set database = workspace.OpenDatabase (dbname, options, read-only,
connect)
The OpenDatabase method syntax has these parts.
Part Description
database An object variable that represents the Database object that you
want to open. workspace Optional. An object variable that represents the
existing Workspace object that will contain the database. If you don't
include a value for workspace, OpenDatabase uses the default workspace.
dbname A String that is the name of an existing Microsoft Jet database
file, or the data source name (DSN) of an ODBC data source. See the Name
property for more information about setting this value. options Optional.
A Variant that sets various options for the database, as specified in
Settings. read-only Optional. A Variant (Boolean subtype) value that is
True if you want to open the database with read-only access, or False
(default) if you want to open the database with read/write access.
connect Optional. A Variant (String subtype) that specifies various
connection information, including passwords.
Settings
For Microsoft Jet workspaces, you can use the following values for the
options argument.
Setting Description
True Opens the database in exclusive mode.
False (Default) Opens the database in shared mode.
**** end quote ****
Which/who is right, you or the help file?
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
"Lyle Fairfield" <Mi************@Invalid.Com> escreveu na mensagem
news:Xn*******************@130.133.1.4... "Roberto Spier" <fo*****@invalid.com> wrote in news:bt************@ID-66191.news.uni-berlin.de:
"Rick Brandt" <ri*********@hotmail.com> escreveu na mensagem news:bt************@ID-98015.news.uni-berlin.de...
I've never tried the code, but the links by themselves don't cause the
back end file to be "in use" unless your front end is actually doing something with them. As long as you close all forms and recordsets that use the links then you should be able to compact the back end from the front end.
Right, but there is a typo in the original code that causes CanBeOpenedExclusively() to always return false:
You need to correct the OpenDatabase argument list, adding an extra comma as bellow:
Set d = P(0).OpenDatabase(FullPath, , True)
form the help file
**** begin quote **** OpenDatabase Method
Opens a specified database in a Workspace object and returns a reference to the Database object that represents it.
Syntax
Set database = workspace.OpenDatabase (dbname, options, read-only, connect)
The OpenDatabase method syntax has these parts.
Part Description database An object variable that represents the Database object that you want to open. workspace Optional. An object variable that represents the existing Workspace object that will contain the database. If you don't include a value for workspace, OpenDatabase uses the default workspace. dbname A String that is the name of an existing Microsoft Jet database file, or the data source name (DSN) of an ODBC data source. See the Name property for more information about setting this value. options Optional. A Variant that sets various options for the database, as specified in Settings. read-only Optional. A Variant (Boolean subtype) value that is True if you want to open the database with read-only access, or False (default) if you want to open the database with read/write access. connect Optional. A Variant (String subtype) that specifies various connection information, including passwords.
Settings
For Microsoft Jet workspaces, you can use the following values for the options argument.
Setting Description True Opens the database in exclusive mode. False (Default) Opens the database in shared mode.
**** end quote ****
Which/who is right, you or the help file?
-- Lyle (for e-mail refer to http://ffdba.com/contacts.htm)
Both! But if it's a bet, then I'll put my money on Help File!
Quoted from the original post: http://groups.google.com/groups?selm...m%4024.9.0.131
Private Function CanBeOpenedExclusively(ByVal FullPath As String) As Boolean
Dim d As Database
Dim p As PrivDBEngine
Set p = New PrivDBEngine
On Error Resume Next
Set d = p(0).OpenDatabase(FullPath, True)
CanBeOpenedExclusively = Not (d Is Nothing)
Set d = Nothing
Set p = Nothing
End Function
This manner, CanBeOpenedExclusively(myPath) always return false, since there
is no read-only argument.
Or maybe (probably!) I'm missing something?!
Regards, Roberto
In article <bt************@ID-66191.news.uni-berlin.de>, "Roberto Spier" <fo*****@invalid.com> wrote: Regards, Roberto
OK, Guys, I love all the discussion, even though much of it is over this
novice programmers head, but I'm still trying to compact a back-end
database! :-)
I found some simpler (and safer) code at http://www.rogersaccesslibrary.com/T...Contents2k.asp
but I still get the same result. It errors out saying the database is in
use.
Here's what I have. I have a single form open, with a button marked Exit.
When I click Exit, it runs a macro. The Macro closes the form, then runs a
function in a module that executes the code from the above source. As I
understand it, when I close the form, nothing else is looking at the data,
but indeed it is still linked. I really don't want to write code to kill
all the links, then compact it, then re-link it all, but the database will
be used by novices, so it needs to work for someone who wouldn't know what
to do if he found the links broken.
Suggestions? (With my thanks.)
Larry L
"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:do********************************@4ax.com... On Wed, 07 Jan 2004 09:33:59 GMT, la***@somewhereinhawaii.net (Larry L)
wrote:Access is noted for bloating a database when you add and delete records frequently. I have always had mine set to compact on close, and that
worksgreat. Now after everyone's advice I split my database, so the data is in a second (back-end) database with all the tables linked. However, now
whenI close the database, it compacts the front end, since that's what's
open,and the back-end grows.
I now have to manually open and close the back-end seperately just to compact it.
Surely there is a better way?
Thanks, Larry L Well, it's not just the bloating. You need to compact the database from
time to time to optimize the table indexes, and clean up nascent corruption
before it presents symptoms.
Yes, with a split front-back end database, you need a way to periodically compact the database, and you can automate that by running Access with the /compact parameter. See "Startup command-line options" in the Access help
for details.
Urk! If no-one else has said this already: get to where the BE is not open
(eg. an unbound main menu form), temprarily drop any performance-enhancing
persistent connection, then do the compact from code within the FE. No need
to run a seperate copy of Access.
TC This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: barbara_dave |
last post by:
Hi, All,
I have an existing access database. It can't be added more data and
its size is 32mb. I wonder it is full. I use access utilities to repair
and compact it, but I got error message...
|
by: raydelex |
last post by:
I have a split database (Access 2003).
Now I need to port the database to the end-users' computer for a
demonstration. When I try to start up the database on the other
computer, it tells me...
|
by: Brian P. Hammer |
last post by:
All,
How do I go about compacting an Access XP database from VB code? I use a database for various reporting information and records are often deleted and created. The size of the database can...
|
by: carriolan |
last post by:
Hi
I have managed to secure a split database. Both frontend and backend
share a common workgroup, common security groups and common users and
permissions, but as in all good stories there is a...
|
by: AAOO (Sean) |
last post by:
When I try to access the back end of a split database, I get the error
message, that it's not trusted by access, and that I should move it to
my computer, or an accessible network location? What...
| |
by: najimou |
last post by:
Hi everyone
I will be having a split database, running on 2 computers via mapped
drive.
computer "A" will have one front end and the back end located in c:
\mydatabse
2 tables have links to...
|
by: theProfessor |
last post by:
We are using a shared split database with all users currently using
Access 2003. The back end is on a shared drive of a state wide WAN.
Each user has a copy of the front end on their local...
|
by: BinaryGirl23 |
last post by:
Hello,
I'm having a bit of a problem regarding my back-end database for Access 2003. The db is set for shared mode, has no programming code at all, only back-end tables that is shared on our...
|
by: hedges98 |
last post by:
There is probably an easy solution to this but I'm paranoid about making any changes to the database in case I do something that can't be reverted back.
Basically, I have a split database -...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
| |
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: 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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |