473,324 Members | 2,548 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,324 software developers and data experts.

CompactDatabase command with variables

Dear reader,

By using the CompactDatabase command I discovered the following unpleasant
situation:

DBEngin.CompactDatabase "DB_a", "DB_b"

The above sentence works perfect, but if I will use the command with
variables from a table it fails, for instance:

DBEnging.ComandDatabase Rst1!DB_old , Rst1!DB_new

The same negative result is by using this commend with string variables as:

Dim DB_a as String
Dim DB_b as String
Dim Rst1 as DAO.Recordset

Set Rst1 = db.OpenRecordset("Tbl_Databases")

DB_a = Rst1!DB_old (fieldname from the table)
DB_b = Rst1!DB_new

DBEnging.ComandDatabase DB_a , DB_b

This instruction set is also not working.

Tanks for any help to solve this situation

Kind regards,
Simon van Beek
Nov 13 '05 #1
1 1696
What error do you get? Are you sure that both Rst1!DB_old and Rst1!DB_new
are valid file names? Do they contain blanks? If so, you need to put quotes
around them:

DBEngine.CompactDatabase Chr$(34) & DB_a & Chr$(34) , Chr$(34) & DB_b
& Chr$(34)
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"S. van Beek" <S.v,Be**@HCCnet.nl> wrote in message
news:41*********************@reader20.nntp.hccnet. nl...
Dear reader,

By using the CompactDatabase command I discovered the following unpleasant
situation:

DBEngin.CompactDatabase "DB_a", "DB_b"

The above sentence works perfect, but if I will use the command with
variables from a table it fails, for instance:

DBEnging.ComandDatabase Rst1!DB_old , Rst1!DB_new

The same negative result is by using this commend with string variables as:
Dim DB_a as String
Dim DB_b as String
Dim Rst1 as DAO.Recordset

Set Rst1 = db.OpenRecordset("Tbl_Databases")

DB_a = Rst1!DB_old (fieldname from the table)
DB_b = Rst1!DB_new

DBEnging.ComandDatabase DB_a , DB_b

This instruction set is also not working.

Tanks for any help to solve this situation

Kind regards,
Simon van Beek

Nov 13 '05 #2

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

Similar topics

1
by: Christopher Brandsdal | last post by:
Hi! I found a database tool-script that has a functin for compacting the database.... What is the point of compacting the database? Is it necessary? Anyone know the advantages of doing this??? ...
12
by: Rhino | last post by:
I am having an odd problem: the sqlj command on my system doesn't work. I am running DB2 (LUW) V8 (FP8) on WinXP. I haven't done an sqlj program since Version 6 of DB2 (LUW) so I checked the...
8
by: Owen Jenkins | last post by:
Hello. For years I've been using the DBEngine.CompactDatabase code to make backups of backend databases. But now I've struck a baffling problem where I get an Invalid Argument error. This...
0
by: S. van Beek | last post by:
Dear reader, By using the CompactDatabase command I discovered the following unpleasant situation: DBEngin.CompactDatabase "DB_a", "DB_b"
3
by: pburling | last post by:
I have been reading the posts regarding the CompactDatabase method and would like to say Thanks to everyone, especially Mr.Steele. I have taken his advice and make a backup from the Backend before...
10
by: jimmy | last post by:
Hi again, sorry for posting two questions so close together but im working on a school project which is due in soon and running into some difficulties implementing the database parts. I have the...
9
by: Endless Story | last post by:
My last version of Python was 2.4, running smoothly on XP with path c: \Python24 - no need even to include this path in PATH; everything worked as it's supposed to at the command line. Just...
5
by: waltbrad | last post by:
Hi folks. I'm learning Python from the Mark Lutz Book, Programming Python 3rd edition. He seems to be able to invoke the Python interpreter from any command line prompt. C:\temp>python ...
5
by: Owen Jenkins | last post by:
I have Access 97, 2000 and 2003 all running on a Win XP box after having just reinstalled XP. Among other problems, I find that Access 97 will not compact a database in code ... ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.