none
/cmd argument and Command() function not working RRS feed

  • Question

  • I am using Access 2010 on my PC and am passing an argument using the /cmd switch. However when I display the Command function using msgbox in the load event of the switchboard form is gives the value "2". What am I doing wrong?

    "C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE" /Cmd "current"  "\\oxnetvtie01\test_extracts$\ICEViewer\Development Area\ICEOrdersViewer_test.accdb"

    

    Tuesday, April 12, 2016 12:49 PM

Answers

  • >>>However when I display the Command function using msgbox in the load event of the switchboard form is gives the value "2". What am I doing wrong?

    According to your description, I have made a sample to try to reproduce this issue, unfortunately, I can't.

    Public Sub CheckCommandLine()
    
         MsgBox Command 
    End Sub
    
    Private Sub Form_Load()
        'switchboard Form load event
        CheckCommandLine
    End Sub

    For more information, click here to refer about Command Function

    • Marked as answer by David_JunFeng Thursday, April 21, 2016 7:56 AM
    Wednesday, April 13, 2016 3:15 AM

All replies

  • /cmd must be the last switch on the command line, as per help:

      Command Line Switches for Access

    Matthias Kläy, Kläy Computing AG

    Tuesday, April 12, 2016 12:58 PM
  • Hmm, not sure if it matters but try removing the quotes around the argument. For example:

    ... /cmd current ...

    Hope that helps...


    • Edited by .theDBguy Tuesday, April 12, 2016 3:14 PM
    Tuesday, April 12, 2016 3:14 PM
  • >>>However when I display the Command function using msgbox in the load event of the switchboard form is gives the value "2". What am I doing wrong?

    According to your description, I have made a sample to try to reproduce this issue, unfortunately, I can't.

    Public Sub CheckCommandLine()
    
         MsgBox Command 
    End Sub
    
    Private Sub Form_Load()
        'switchboard Form load event
        CheckCommandLine
    End Sub

    For more information, click here to refer about Command Function

    • Marked as answer by David_JunFeng Thursday, April 21, 2016 7:56 AM
    Wednesday, April 13, 2016 3:15 AM