Database is so "Heavy"

G

gatarossi

Dear all,

In my access database, I need to do a lot of consults, to exclude and
to include data in the tables. Then the database stay so "heavy".

I know that I can access Tools ==> compact and repair database, then
the database stay with your correct measured.

Is there any way to do this in vba code?

Thanks a lot!!!

André.
 
W

Wayne-I-M

Hi

You could do this from an OnClick - something like


Private Sub ButtonName_Click()
Dim strDBtoBackUp As String
strDBtoBackUp = "C:\Documents and Settings\My Documents\DBName.mdb"
DBEngine.CompactDatabase strDBtoBackUp
End Sub


change the path to what it is.
 
D

Douglas J. Steele

Just note that you cannot do this to the database in which the code is
running.
 
J

John W. Vinson

In my access database, I need to do a lot of consults, to exclude and
to include data in the tables. Then the database stay so "heavy".

Do you have a large number of queries ("consults" is not a good translation!)
because you have different criteria in each query? If so, consider using
Parameter Queries. Rather than a query "qryJune" with criteria

BETWEEN #6/1/2007# AND #6/30/2007#

and similar queries for July, August and so on, you can use ONE query with a
criterion

BETWEEN [Forms]![FormName]![txtStart] AND [Forms]![FormName]![txtEnd]

and similarly for many other queries.

John W. Vinson [MVP]
 
S

sora alsaad

hi
How I can solution this problem plz
thanks
John W. Vinson said:
In my access database, I need to do a lot of consults, to exclude and
to include data in the tables. Then the database stay so "heavy".

Do you have a large number of queries ("consults" is not a good
translation!)
because you have different criteria in each query? If so, consider using
Parameter Queries. Rather than a query "qryJune" with criteria

BETWEEN #6/1/2007# AND #6/30/2007#

and similar queries for July, August and so on, you can use ONE query with
a
criterion

BETWEEN [Forms]![FormName]![txtStart] AND [Forms]![FormName]![txtEnd]

and similarly for many other queries.

John W. Vinson [MVP]
 
J

John W. Vinson

hi
How I can solution this problem plz

Please explain the problem in a way that someone can understand it.

You have a lot of queries. Do you want to reduce the number of queries? Do you
want to automatically compact the database? What IS the problem?

John W. Vinson [MVP]
 
Top