PDA

Click to See Complete Forum and Search --> : Send PATH Parameter to exe


ermingut
Jan 19th, 2000, 12:00 AM
It goes like this: You can read parameter from command line with

Command()

Something like this:

Private Sub Form_Load()
par = Command 'parameter into variable
Set db = DBEngine.OpenDatabase(par)
End Sub

You can execute your program with command line:

myexe.exe c:\database.mdb

Vairable par get value " c:\database.mdb". I thing that you'll have to remove [space].

That must work.

Ermin

netSurfer
Jan 19th, 2000, 12:01 AM
like so:

dim strDatabase as string

strdatabase = command
Set db = DBEngine.OpenDatabase(strdatabase)

this assumes that you run the exe with the d:\database.mdb after it.

ermingut
Jan 19th, 2000, 12:20 AM
I thing that must work.

you can also add character (/) in front of your parameter. Like this:

myapp.exe /c:\my_db.mdb

In your code you can find this character and everything behind is path and name of your database.


That is the cond from my program and it works. App accept two parameters:

Private Sub Form_Load()
dim par as string
par = Command
For i = 2 To Len(par)
If Mid(par, i, 1) = "/" Then
Label1(0).Caption = Mid(par, 2, i - 2)
Label1(1).Caption = Mid(par, i + 1)
Exit For
End If
Next i
end sub
command line is like this:
myapp.exe /c:\database.mdb /table_partner

Label1(0).Caption -> "c:\database.mdb"
Label1(1).Caption -> "table_partner"

Good luck!

Ermin

ADM1AVD
Jan 19th, 2000, 11:49 AM
I need to pass the parameter "d:\Database.mdb" from the command line.
Not hard coded in the program like below code

Example
Set db = DBEngine.OpenDatabase("D:\Database.mdb")

Please Help.....Thanks