Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

Close Access file to compress

Hello Experts.

 In my program use Adotable to connect to msaccess file .
 I have a Function to compress file msAsscecc.

my question:

 How to close file msaacess before compress, I'd tried :

 Procedure TForm1.Button1Click(Sender: TObject);
 begin

 Adotable1.close;
 CompressData(filename);
......

but I get error .I know I can compress if data file not open.

 Please teach me how close access file to compress then reload it.

 Thanks.
 
 
0
z27
Asked:
z27
1 Solution
 
geobulCommented:
Hi,

Add TADOConnection on the form. Write ADOConnection1.ConnectionString as it was in TADOTable1. Clear ADOTable1.ConnectionString and set its Connection property to ADOConnection1. Then write:

  ADOConnection1.Close;
  CompressData(filename);

Regards, Geo
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now