PC Review


Reply
Thread Tools Rate Thread

Command() Function to get command line parameter not working

 
 
=?Utf-8?B?TWlrZSBCIGluIFZU?=
Guest
Posts: n/a
 
      10th Nov 2006
I'm trying to use the Command function to pass a paramter into Access and it
isn't working. If the parameter is "auto" I want to call a macro to print a
bunch of reports, otherwise I want to display a form.

The Icon is setup as "S:\admin\excel queries.mdb" /cmd "auto"

I have in the only module, and have the AutoExec Macro call it:

Public Function CheckCommandLine()

' Check the value returned by Command function and display
' the appropriate form.

MsgBox Command() ' for debug purposes

If Command = "auto" Then
DoCmd.RunMacro "mcrPrintReports1"
Else
DoCmd.OpenForm "Form1"
End If

End Function

But the msgbox shows up empty and it always just runs the form.
Help!
 
Reply With Quote
 
 
 
 
Stefan Hoffmann
Guest
Posts: n/a
 
      10th Nov 2006
hi Mike,

Mike B in VT wrote:
> The Icon is setup as "S:\admin\excel queries.mdb" /cmd "auto"

You need to specify the Access executable, cause otherwise the shell
handler, which is not aware of command options, is invoked:

"C:\Path\MSACCESS.EXE" "C:\Path\.MDB" /cmd "auto"


mfG
--> stefan <--
 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      10th Nov 2006
Include the path to msaccess.exe in the shortcut, e.g.:

"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"
"S:\admin\excel queries.mdb" /cmd auto

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mike B in VT" <(E-Mail Removed)> wrote in message
news:48815436-C6BF-4436-87C5-(E-Mail Removed)...
> I'm trying to use the Command function to pass a paramter into Access and
> it
> isn't working. If the parameter is "auto" I want to call a macro to print
> a
> bunch of reports, otherwise I want to display a form.
>
> The Icon is setup as "S:\admin\excel queries.mdb" /cmd "auto"
>
> I have in the only module, and have the AutoExec Macro call it:
>
> Public Function CheckCommandLine()
>
> ' Check the value returned by Command function and display
> ' the appropriate form.
>
> MsgBox Command() ' for debug purposes
>
> If Command = "auto" Then
> DoCmd.RunMacro "mcrPrintReports1"
> Else
> DoCmd.OpenForm "Form1"
> End If
>
> End Function
>
> But the msgbox shows up empty and it always just runs the form.
> Help!



 
Reply With Quote
 
=?Utf-8?B?TWlrZSBCIGluIFZU?=
Guest
Posts: n/a
 
      10th Nov 2006
Thanks for the quick reply Stefan.

Works great.

Mike

"Stefan Hoffmann" wrote:

> hi Mike,
>
> Mike B in VT wrote:
> > The Icon is setup as "S:\admin\excel queries.mdb" /cmd "auto"

> You need to specify the Access executable, cause otherwise the shell
> handler, which is not aware of command options, is invoked:
>
> "C:\Path\MSACCESS.EXE" "C:\Path\.MDB" /cmd "auto"
>
>
> mfG
> --> stefan <--
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
command line parameter? DTPSniper Windows XP New Users 2 25th May 2008 09:53 PM
autorun.inf - shell\..\command with command line parameter doesn'twork kakii Windows XP Help 1 17th May 2007 08:54 PM
command line parameter dave Microsoft Access 1 10th Jan 2005 03:11 AM
command line parameter Paul Mars Windows XP General 3 10th Dec 2004 08:00 AM
command-line parameter Sandro Microsoft VB .NET 2 19th Nov 2003 11:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:51 PM.