Results 1 to 4 of 4

Thread: Send PATH Parameter to exe

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Location
    SLOVENIA, Europe
    Posts
    110

    Post

    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


  2. #2
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    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.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Location
    SLOVENIA, Europe
    Posts
    110

    Post

    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

  4. #4
    New Member
    Join Date
    Jan 2000
    Posts
    5

    Post

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width