473,396 Members | 2,139 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.

Compact backend of databse while front Open

Can someone give some advice on this . I have a split db, we want to compact the backend and the end of a process. This DB is running in virtual office.
Thanks
Feb 27 '07 #1
4 1800
Rabbit
12,516 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. CompactDatabase "File Path", "Compacted File Path" ' Must be different
  2. Kill "File Path"
  3. FileCopy "Compacted File Path", "File Path"
  4. Kill "Compacted File Path"
Feb 28 '07 #2
NeoPa
32,556 Expert Mod 16PB
As there may be situations where the file(s) are locked, it's probably a good idea to use 'On Error Resume Next' code to allow this code to process through.
Expand|Select|Wrap|Line Numbers
  1. On Error Resume Next
  2. CompactDatabase "File Path", "Compacted File Path" ' Must be different
  3. Kill "File Path"
  4. Name "Compacted File Path" As "File Path"
  5. Kill "Compacted File Path"
  6. On Error Goto 0
Also, probably better to use the rename command (Name ... As ...) rather than a copy.
Mar 1 '07 #3
Rabbit
12,516 Expert Mod 8TB
I only used the Copy because I couldn't find the rename command lol. Actually, I was looking for a move command and couldn't find that either.

Either way, you would get rid of the last kill statement if you use the rename command.
Mar 1 '07 #4
NeoPa
32,556 Expert Mod 16PB
I only used the Copy because I couldn't find the rename command lol. Actually, I was looking for a move command and couldn't find that either.
I believe the Name command can work as a move in the same way as the 'mv' command in Unix does both. You'd have to test to be sure though.
Either way, you would get rid of the last kill statement if you use the rename command.
In fact, if it hadn't been there already I would have added it.
Consider the rename failing due to the file being open when the rename is attempted. This code won't give proper error messages, but at least in that case it will tidy up the file that's left behind.
Mar 1 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Larry L | last post by:
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...
0
by: krisa | last post by:
Would appreciate any help on this: I have an A2K frontend/backend application developed & tested on client's "usual" server. Then moved both back and front ends to a different server so...
1
by: ColinWard | last post by:
I don'tunderstand why when you use Compact and Repair, only the front end is compacted? I understand about repairing, because the front end stores the forms, queries etc. but the backend is where...
5
by: Susan Bricker | last post by:
Greetings. I just discovered the 'Compact on Close' option in Access-Tools-Options-General Tab. It certainly sounds like a smart idea to me. But before I turn that option on I thought I'd check...
5
by: Lauren Wilson | last post by:
Hi folks, Somewhere, I recently saw an article header titled: "How to compact and Repair a back-end Access db from the front-end using VBA" or words to that effect. Now that I need it, I...
1
by: Kjell Harnesk | last post by:
If I set the option to compact on exit will the backend compact when all the front ends close the connection to it? I guess not. In that case, is there a way to by code in the front end compact the...
2
by: bobdydd | last post by:
Hi Everybody For Microsoft Access 2000 and above Windows XP I am trying to mimic the action of this command that at the moment runs from the start>>all programs at the bottom left of the...
43
by: perryche | last post by:
I have searched the site and probably came across dozens of posts... I am somewhat confused about the replies... here is my situation, see if someone can point me to where to go: I have splitted...
8
by: rdemyan via AccessMonster.com | last post by:
I've converted my application from A2K format to A2003 format. I tried to follow Allen Browne's protocol in getting my app into A2003 (although I was unable to find informtion on the conversion...
2
by: Ron | last post by:
Hi All, Using WinXP pro/Access 2000. I have a database that's been used for about 5 months. Transferred lots of data from a dos based program, then the users have been using it for that 5...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
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...
0
agi2029
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,...

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.