Connecting Tech Pros Worldwide Help | Site Map

CompactDatabase command with variables

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 04:03 AM
S. van Beek
Guest
 
Posts: n/a
Default 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



  #2  
Old November 13th, 2005, 04:03 AM
Douglas J. Steele
Guest
 
Posts: n/a
Default Re: CompactDatabase command with variables

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,Beek@HCCnet.nl> wrote in message
news:4186a919$0$773$3a628fcd@reader20.nntp.hccnet. nl...[color=blue]
> 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[/color]
as:[color=blue]
>
> 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
>
>[/color]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.