Startup command line options

  • Thread starter Thread starter Elwin
  • Start date Start date
E

Elwin

I came across some documentation that references a '/cmd'
command line switch you can use to pass parameters to your
database on startup. If I Start/Run my database using the
following;

C:\myfile.mdb /cmd 1

Private Sub Form_Load()
var = Command()
End Sub

I'd expect the Command() function to return 1 in the OnLoad
() event of my startup form, but it seems to return Null
no matter what I do. I'm hoping that someone can explain
to me how I can properly effect the value returned by the
Command() function.
 
Elwin said:
I came across some documentation that references a '/cmd'
command line switch you can use to pass parameters to your
database on startup. If I Start/Run my database using the
following;

C:\myfile.mdb /cmd 1

Private Sub Form_Load()
var = Command()
End Sub

I'd expect the Command() function to return 1 in the OnLoad
() event of my startup form, but it seems to return Null
no matter what I do. I'm hoping that someone can explain
to me how I can properly effect the value returned by the
Command() function.


I believe the command line arguments are only processed when
you use the application's full program path:

C:\ProgramFiles\whatever\msaccess.exe C:\myfile.mdb /cmd 1
 
You're correct Marshall. I made the correction, but /cmd
still isn't functioning as advertised. I've got a work
around in place that makes use of the /x switch to execute
a macro that opens a form which executes some code and
closes itself. Seems to work ok, but it's needlessly
complicated if only I could get /cmd to pass my argument
would be much better.
 
Elwin said:
You're correct Marshall. I made the correction, but /cmd
still isn't functioning as advertised. I've got a work
around in place that makes use of the /x switch to execute
a macro that opens a form which executes some code and
closes itself. Seems to work ok, but it's needlessly
complicated if only I could get /cmd to pass my argument
would be much better.

I don't know what issue you're running into, it works fine
for me.
 
Back
Top