Topic: open file with associated application

Hello again,
How do I open a file (Microsoft Access 2010) on a local drive or network drive with script?
I try this below but don't work.
Thanks.

procedure FrmTest_bWip_OnClick (Sender: string; var Cancel: boolean);

begin
   
OpenFile (Path=Z:\WIP\WIP.accdb); // Start Access and open the file WIP.accdb

end;

Re: open file with associated application

Hello,

I was able to check it, works.
OpenFile ('Z:\WIP\WIP.accdb');


when you double click on file WIP.accdb, it opens automatically by Access?

Dmitry.

Re: open file with associated application

Hello,

The script below does not work. Is syntax wrong? Maybe you can help?
Thanks

//procedure frmTest_OnShow (Sender: string; Action: string);
//begin
//    frmTest.bWip.Default := False;
//end;

procedure FrmTest_bWip_OnClick (Sender: string; var Cancel: boolean);
//procedure frmTest_bWip_OnClick (Sender: string; var Key: Word; Shift, Alt, Ctrl: boolean);


begin
//   OpenFile ('Z:\WIP\WIP.accdb'); // Start the program or open a file the default program
OpenFile ('d:\Win7 audit install info.txt'); // Start the program or open a file the default program
end;

begin

end.

Re: open file with associated application

Syntax is correct, do you get any message of error?

Dmitry.

Re: open file with associated application

Hi,

No error message.
And with this pascal code below?

uses Process;
var
    RunProgram: TProcess;
begin

    RunProgram := TProcess.Create(nil);

    RunProgram.CommandLine := ‘Path and Name of Program’;

     RunProgram.Execute;

     RunProgram.Free;

end;

Work also not, because TProcess Classes is not available.
I send the project  AC-Test_DEV-Dmitriyj.zip  to my dropbox.
Thanks

Re: open file with associated application

I have made some changes, please, check it.

Dmitry.

Re: open file with associated application

Hi again,

Now generate MVDB this error.  Undeclared identifier: 'Openfile'  how to fix this problem?
Thanks

procedure FrmTest_bWip_OnClick (Sender: string; var Cancel: boolean);
begin
OpenFile ('Z:\WIP\WIP.accdb'); // Start the program or open a file the default program

end;

Re: open file with associated application

carlo_dj

Please, download unofficial 1.41 version
https://www.dropbox.com/s/fr76z69sc69l1 … 201.41.zip

Dmitry.

Re: open file with associated application

Thanks,

This problem is now fixed with ver. 1.41

Re: open file with associated application

Hello,

On my home PC no problem, but I've still a problem connect to network drive on my work place. I did try with this parameters below.
Maybe you have a tip?
Thanks


procedure FrmTest_bWip_OnClick (Sender: string; var Cancel: boolean);
begin

   // OpenFile ('Z:\WIP\WIP.accdb'); //  Don't work!      Start the program or open a file the default program

   //Full Path in file explorer is in my situation :  AIRMITI$ (\\AIRPF001) (Z:)  File try to open is:  Z:WIP\WIP.accdb

       OpenFile ('\\AIRMITI$\AIRPF001\Z:\WIP\WIP.accdb'); // Start the program or open a file the default program
          //    OpenFile ('\\Z:\WIP\WIP.accdb'); // Start the program or open a file the default program



end;

Re: open file with associated application

i think you have wrong path to file, please try to open this on Explorer:
\\AIRMITI$\AIRPF001\Z:\WIP\WIP.accdb


it's works?

Dmitry.

Re: open file with associated application

Hi, sorry
I was wrong! the NW drives are mapped. So the correct path =   Z:\WIP\WIP.accdb   in my situation. All server drives here are mapped. Thanks for your time you spend for this project.