0

Can anyone tell me what I need to do to format a VBA shell command to launch MS Access and preload a network based database. I have tried this with the normal windows path and using a UNC i.e Shell "msaccess.exe \\OMRSRV\Projects\Clients\HP\DailyCustomerSatisfaction\HP.accde", vbMaximizedFocus

Cant get it to work - Invalid procedure call or argument!

dario
  • 5,149
  • 12
  • 28
  • 32
Andrew Seabrook
  • 397
  • 2
  • 17
  • This `Shell "msaccess.exe c:\temp\temp_db.accdb", vbMaximizedFocus` works fine when running in VBA in Excel. Which part of Office are you using to run the VBA? – ChipsLetten May 28 '15 at 22:36
  • You can also try wrapping the path to the database file in quotes: `Shell "msaccess.exe " & Chr$(34) & "c:\some path\temp db.accdb" & Chr$(34), vbMaximizedFocus` in case there are any spaces, etc in the path. – ChipsLetten May 28 '15 at 22:41
  • @ChipsLetten Yes indeed that works fine, however it doesnt work when the database is on a network resource! Tried with both mapped drives and the UNC format including the server name. Its being run via user button_click in Outlook. – Andrew Seabrook May 29 '15 at 08:19
  • @ChipsLetten Your Chr$(34) suggestion is not having it either unfortunately same error - Invalid procedure call! – Andrew Seabrook May 29 '15 at 08:22
  • 1
    I can understand that UNC might not work but a mapped drive should be fine. Can only offer couple more ideas - 1) presumably simply starting Access from the shell command works fine? 2) Can you create a desktop shortcut that works ok? Looking at the properties of the shortcut might give you inspiration... – ChipsLetten May 29 '15 at 10:31

1 Answers1

0

Thanks @ChipsLetten you kicked the cage nicely there even if you didnt directly offer the solution: it could not have been simpler - msaccess.exe required its path to be included in the statement!

Andrew Seabrook
  • 397
  • 2
  • 17