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]