UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Shell Open Executable With Argument, Access 2013    
 
   
fitzdesignz
post Jun 21 2019, 04:27 PM
Post#1



Posts: 62
Joined: 14-June 18



I'm using the ShellExecute API to launch an executable file from my access frontend.
Here is the API: http://access.mvps.org/access/api/api0018.htm

My problem is that I cant pass a argument to it. When I do it fails "File not found"

Any ideas on how I can achieve this?

here is my watered down code:

CODE
'   Get server file path
    Dim ServerPath As String
    Dim VersionNo As String
    Dim strProgramName As String
    Dim strArgument As String
    Dim strUpdatePath As String
    
    
    ServerPath = DLookup("[ServerPath]", "tbl_AppSystemFront")
    VersionNo = DLookup("[CurrentVersionNumber]", "tbl_AppSystemBack")
    strProgramName = ServerPath & "Current Installer\CIQ-Installer-" & VersionNo & ".exe"
    strArgument = " /PASSIVE"
    strUpdatePath = strProgramName & strArgument
            
    
    If (DLookup("VersionMatch", "qry_AppVersion") = "No") Then
        Call fHandleFile(strUpdatePath, WIN_NORMAL)



I was using a much simpler Shell which worked on windows 7 but not on windows 10 fails with run-time error 5 "Invalid Procedure Call or Argument."


CODE
Call Shell("""" & strProgramName & """ """ & strArgument & """", vbNormalFocus)



Go to the top of the page
 
Doug Steele
post Jun 21 2019, 06:43 PM
Post#2


UtterAccess VIP
Posts: 22,181
Joined: 8-January 07
From: St. Catharines, ON (Canada)


Just guessing, but because of the space in Current Installer, try

CODE
  strUpdatePath = """" & strProgramName & """ " & strArgument



--------------------
Doug Steele, Microsoft Access MVP (2000-2018)
Personal webpage
Microsoft profile
Co-author: Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs, published by Wiley
Co-author: Effective SQL: 61 Specific Ways to Write Better SQL, published by Addison-Wesley Professional
Technical Editor: Access 2010 Bible, Access 2013 Bible, Access 2016 Bible, all published by Wiley
Technical Editor: SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, 4th Edition, published by Addison-Wesley Professional
Go to the top of the page
 
ITguaranteed
post Jun 21 2019, 06:48 PM
Post#3



Posts: 29
Joined: 19-June 19
From: Tasmania, Australia


can you try

CODE
debug.print """" & strProgramName & """ """ & strArgument & """"


just before you shell it and see what you get.
Go to the top of the page
 
theDBguy
post Jun 21 2019, 06:59 PM
Post#4


Access Wiki and Forums Moderator
Posts: 75,725
Joined: 19-June 07
From: SunnySandyEggo


Hi. Shell should still work on Windows 10, but I’m not in front of a computer right now to test it.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
ADezii
post Jun 21 2019, 07:22 PM
Post#5



Posts: 2,461
Joined: 4-February 07
From: USA, Florida, Delray Beach


Try:
CODE
Dim retVal As Variant
Dim strArgument As String

strArgument = "C:\Test\Test File.txt"

retVal = Shell("Notepad.exe " & strArgument, vbNormalFocus)
Go to the top of the page
 
fitzdesignz
post Jun 24 2019, 12:40 AM
Post#6



Posts: 62
Joined: 14-June 18



Okay so maybe the shell issue isn't a windows 7 vs 10 thing. Could it be a 32 vs 64 bit issue?
Go to the top of the page
 
ITguaranteed
post Jun 24 2019, 12:59 AM
Post#7



Posts: 29
Joined: 19-June 19
From: Tasmania, Australia


Did you confirm the file path for the executable is the same on the machine that isn't cooperating.
also can you log in as an admin user on that machine and try as well to rule out a permissions thing.
This post has been edited by ITguaranteed: Jun 24 2019, 01:00 AM
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    21st July 2019 - 09:54 AM