Shell command

User avatar
Steve_in_Kent
4StarLounger
Posts: 419
Joined: 04 Feb 2010, 11:46

Shell command

Post by Steve_in_Kent »

I'm attempting to use an auto update program i found on the net. dates back a few years but appears to work. (mostly).

The version check occurs in the main program, and an auto update mdb is run.

In this mdb, to run the new version of the database that has been replaced, the shell command is used. this is the code:-
strcmd = "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE " & Chr(34) & "C:\Documents and Settings\All Users\DL-Special.mdb" & Chr(34)

'strcmd = strcmd + " /wrkgrp S:\Document Library\SYSTEM.mdw"
'strcmd = strcmd + " /user AUser /pwd Whatever"

Call Shell(strcmd, vbNormalFocus)
DoEvents: DoEvents: DoEvents
The code above seems to work, (adding the chr(34)s)... however, i also need to add the workgroup and user pass to the strcmd variable, i've tried various ways, but cannot seem to get it just right.
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!

User avatar
HansV
Administrator
Posts: 78443
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Shell command

Post by HansV »

Does it work if you use

strcmd = strcmd & " /wrkgrp " & Chr(34) & S:\Document Library\SYSTEM.mdw" & Chr(34)
strcmd = strcmd & " /user AUser /pwd Whatever"
Best wishes,
Hans

User avatar
Steve_in_Kent
4StarLounger
Posts: 419
Joined: 04 Feb 2010, 11:46

Re: Shell command

Post by Steve_in_Kent »

strcmd = strcmd & " /wrkgrp " & Chr(34) & "S:\Document Library\SYSTEM.mdw" & Chr(34)
strcmd = strcmd & " /user AUser /pwd Whatever"

Added a speech mark shown above, and its working.

cheers hans. the amount of differing variations i went through to try to get it to work :sad:

:cheers:
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!

User avatar
HansV
Administrator
Posts: 78443
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Shell command

Post by HansV »

Sorry, should have noticed that. Glad you got it working.
Best wishes,
Hans

grovelli
4StarLounger
Posts: 528
Joined: 26 Jan 2010, 15:14

Re: Shell command

Post by grovelli »

Does the auto update mdb close after opening the new version of the database?