Hi Micron
Thanks for the PM explaining what you meant - my apologies!
You are indeed correct that I omitted a vital line from my earlier code in post #13.
Added in RED below and also corrected in the earlier post
For the benefit of anyone else reading this, I've attached a very basic test database.
There are 3 command line options: /cmd "Admin" ; /cmd/ "Settings" ; /cmd "Attendance"
Or it can be opened with no command line switch
It has the following code in the form load event of the startup form frmMain
Code:
Private Sub Form_Load()
'get the command line switch used to open the app (if any)
Dim ComLineArgs As String
ComLineArgs = Trim(Command())
Select Case ComLineArgs
Case "Admin"
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "frmAdmin"
Case "Settings"
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "frmSettings"
Case "Attendance"
DoCmd.Close acForm, Me.Name
'run code
UpdateAttendance
Case Else
'do something else
End Select
'any other code here
End Sub
The zip file includes the test app & example shortcuts (obviously the path will need updating).
It also includes a Word doc with additional information on several Access switch options / startup conditions
HTH