How to start microsof access with parameter through runtime.exec

Hi,

I try to start access with parameter like this:

String[] cmd = new String[4];

cmd[0] = "C:\\Programme\\Microsoft Office\\OFFICE11\\MSACCESS.EXE";

cmd[1]= "C:\\MyDB.mdb ";

cmd[2] = "/cmd";

cmd[3] = "parameter1 parameter2";

Runtime rt = Runtime.getRuntime();

Process proc = rt.exec(cmd);

However the access mdb startet but it seems not to take the parameter i want to put in to access.

Have anyone an Idea, what is wrong here?

Thanks

[508 byte] By [Anh-Truonga] at [2007-11-26 15:49:32]
# 1
You can use a batch file (*.bat) the content of the batch file"START C:\...\mibase.mdb parametro1 parametro2"START run the file and find the application to run this fileIn your application JavaRuntime.exec("mibat.bat");
danjaredga at 2007-7-8 22:09:11 > top of Java-index,Desktop,Runtime Environment...
# 2

Hi

What do you expect Access to do?

The /cmd command line option sets the value that is returned by VBA Command function (see http://msdn2.microsoft.com/en-us/library/aa211469(office.11).aspx).

If you want to start a macro, you would need the /x switch (see http://office.microsoft.com/en-us/access/HA101666051033.aspx).

Hope this helps

Christoph

Christoph.Nievergelta at 2007-7-8 22:09:11 > top of Java-index,Desktop,Runtime Environment...