Hello All,
I was wondering if anyone had ever experienced this.
When ever I use my DB, it continues to get larger. Is there away to automatically compact the database upon closing or opening? Any help would be greatly apprecited.
If you need some more information, please let me know.
Apr 3 '07
53 4839 Denburt 1,356
Recognized Expert Top Contributor
strDBName ,strTempDB
strDBName is your database name
strTempDB merely a temporary db which will be deleted using the script. -
Path = GetPath
-
strTempDB = Path & "Comp0001.mde"
-
strDBName = Path & "MyMDE.mde"
-
Function GetPath
-
' Return path to the current script
-
path = WScript.ScriptFullName ' script file name
-
GetPath = Left(path, InstrRev(path, "\"))
-
End Function
-
The above Function only works if it is in the same directory as the database.
My version of access does not recognize WSscript. and what is this vbcrlf Thanks again
Denburt 1,356
Recognized Expert Top Contributor
Sorry the following should be in the VBS script: -
Path = GetPath
-
'Temporary db to be deleted once Compact is complete
-
strTempDB = Path & "Comp0001.mde"
-
'Your .mdb or mde file name here
-
strDBName = Path & "MyMDE.mde"
-
-
Function GetPath
-
' Return path to the current script
-
path = WScript.ScriptFullName ' script file name
-
GetPath = Left(path, InstrRev(path, "\"))
-
End Function
-
I am not sure I know what that means.
NeoPa 32,566
Recognized Expert Moderator MVP
I tried this snippet before. But it can only be used on a DB you are not currently in. I need someway to compact on closing. Any thoughts on this? I will keep looking for compact on close.
Compact on Close was introduced in the next version (2K) :( vbCrLf is a predefined string within VBA which is just a Carriage-Return / Line-Feed sequence.
As denburt says, the ability to Compact your current database depends on getting out of it first - hence his idea to use VBScript.
When I post the second item from your post: -
Path = GetPath
-
strTempDB = Path & "Comp0001.mde"
-
strDBName = Path & "MyMDE.mde"
-
Function GetPath()
-
' Return path to the current script
-
Path = WScript.ScriptFullName ' script file name
-
GetPath = Left(Path, InstrRev(Path, "\"))
-
End Function
-
I get an error when I compile that says invalid outside procedure. Where should I put this exactly, does it matter what I call the module?
Also the .mde, is that the same as .mdb. which should I use?
I just now realized that I should paste -
Path = GetPath
-
strTempDB = Path & "Comp0001.mde" ...
in a seperate script file, because that is what you said to do, and I just did not listen, oops. Sorry. Does it matter what I call it?
Also when I compile my Form code, it does not recognize wscript. any thoughts?
Denburt 1,356
Recognized Expert Top Contributor
That snippet of code should be in your VBS script not the database. Make sure the database and script are in the same location or that function will not work as expected. See this post
Your database can be either a mdb or mde. When you are in an MDB you can create an MDE which is simply creating a copy of your database that is completely compiled a little quicker and your users can't go into the code.
Your database can be either a mdb or mde. When you are in an MDB you can create an MDE which is simply creating a copy of your database that is completely compiled a little quicker and your users can't go into the code.
Ok thanks. Any ideas about WScript?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Charles McCaffery |
last post by:
I have written a database with auto-numbering and now wish to remove alkl of
my test data and set the auto-numbering back to one. How do I do this
please?
Charles McCaffery.
|
by: Corepaul |
last post by:
I am new to Access 2000. My operating system is Windows 2000.
In the early stage of development I noticed something weird. On my form, I have
a Command Button named "btnAlbumUp". The first time that I reference this
button in VBA code, the Visual Basic Editor capitalizes the P changing
btnAlbumUp.SetFocus
to
|
by: Willem |
last post by:
Based on MK's TSI_SOON (http://www.trigeminal.com/)I've created a
nifty little procedure that - whenever you compact you db you get an
incremental backup copy.
Given that you have a table with version information you get
incremental backups on a per-version basis.
SEE CODE BELOW
Basic idea is: start TSISOON with the options:
1. "compact...
|
by: John Baker |
last post by:
Hi:
I know this is a strange question, but I have inherited a system where files are copied
and records re auto numbered (as an index field) )frequently, and I am wondering how high
the number can go without the system crashing.
An ancillary question is how one resets an auto number so that the sequence starts again
at 1.
In the case...
|
by: trueblue7 |
last post by:
I apologize if this question has been asked before...
I'm trying to reset autonumber fields back to 1. The autonumber fields are
part of the composite primary keys.
I followed the MS help with a temp table and append query. I can change the
number to anything but 1. I'm using Access XP and saving as 2000.
Any help is appreciated.
| |
by: SQL Server |
last post by:
Hi,
The tempdb file on one of our servers grew very large and used all
available disk space. This is SQL Server 2000 SP4. I have installed
hotfix version 8.00.2187. I opened a profiler trace but can't still get
to the root of the problem. Any help will be appreciated.
Egbon
*** Sent via Developersdex http://www.developersdex.com ***
|
by: deepak |
last post by:
Hi All,
In C I heard the stack grows from top to bottom and heap from bottom to
top.
Is it compiler depend?
|
by: Wayne L |
last post by:
Ok now everyone has mentioned not to use auto number if it means anything to the user. My application uses the auto number for exporting only. I append the mastertbl column with my starting number of 0001(4 digits) (prior to populating the table). When information is imported and appended via a query to the mastertbl it will start with 0002 and...
|
by: Fiddler2 |
last post by:
I noticed that after running compact/repair, I have to recompile my code for the program not to break the next time I open it. What happens is the auto exec macro runs the main() module, then hangs with the second line of code highlighted. No error message, just hangs. If I stop it and recompile the code, it runs again. Does anyone know anything...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| | |