You need to combine your Path to MS Access with your DB as Parameter.
string dbPath = @"c:\MyProgram.mdb";
string pathToAccess = @"C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE";
ProcessStartInfo psiMDB = new ProcessStartInfo(pathToAccess);
psiMDB.Arguments = dbPath + " /cmd 1";
Process p = Process.Start(psiMDB);
Also don't forget to attach /cmd
before you put the next parameter in.
Additional VBA Code for reading Startup Arguments
Option Compare Database
Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineW" () As Long
Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (MyDest As Any, MySource As Any, ByVal MySize As Long)
Sub PrintStartupArguments()
MsgBox CmdLineToStr()
End Sub
Function CmdLineToStr() As String
Dim Buffer() As Byte
Dim StrLen As Long
Dim CmdPtr As Long
CmdPtr = GetCommandLine()
If CmdPtr > 0 Then
StrLen = lstrlenW(CmdPtr) * 2
If StrLen > 0 Then
ReDim Buffer(0 To (StrLen - 1)) As Byte
CopyMemory Buffer(0), ByVal CmdPtr, StrLen
CmdLineToStr = Buffer
End If
End If
End Function