Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Developer Toolkits / November 2006

Tip: Looking for answers? Try searching our database.

Subst command from RunCode

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kathy Webster - 15 Nov 2006 19:54 GMT
How can I get my database to execute this DOS substitute command?

subst K: "%appdata%"

Many thanks.
Kathy
Kathy Webster - 16 Nov 2006 18:07 GMT
Anyone??

> How can I get my database to execute this DOS substitute command?
>
> subst K: "%appdata%"
>
> Many thanks.
> Kathy
Douglas J. Steele - 17 Nov 2006 01:42 GMT
I'm not positive, but I believe you should be able to use the Shell
function, but you need to prefix it with details of the Dos Command
instruction. You may also have to use the Environ function to get the value
of %appdata% for you:

Shell "cmd subst K:  " & Chr(34) & Environ("appdata") & Chr(34)

If there's a chance you'll be doing this on an older operating system, you'd
probably be best off using the Environ function to return the value of
%comspec%, rather than hard-coding it to cmd, as I did above.

Shell Environ("comspec") & " subst K:  " & Chr(34) & Environ("appdata") &
Chr(34)

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> How can I get my database to execute this DOS substitute command?
>
> subst K: "%appdata%"
>
> Many thanks.
> Kathy
Kathy Webster - 17 Nov 2006 20:15 GMT
Sorry, Doug, no go. :-(
I put your line in the RunCode of a macro and a DOS window opens and stays
open (minimized), and no K: drive has been activated.
btw, this is XP, so older OS is not an issue.

> I'm not positive, but I believe you should be able to use the Shell
> function, but you need to prefix it with details of the Dos Command
[quoted text clipped - 16 lines]
>> Many thanks.
>> Kathy
Douglas J. Steele - 18 Nov 2006 03:19 GMT
Sorry, turns out subst is actually an executable, so you don't need to
invoke the DOS command processor.

Shell "subst K:  " & Chr(34) & Environ("appdata") & Chr(34)

is all you need.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Sorry, Doug, no go. :-(
> I put your line in the RunCode of a macro and a DOS window opens and stays
[quoted text clipped - 21 lines]
>>> Many thanks.
>>> Kathy
Kathy Webster - 18 Nov 2006 17:47 GMT
Once again, Doug, you are my hero! Kudos have been given to you above that
line of code!

> Sorry, turns out subst is actually an executable, so you don't need to
> invoke the DOS command processor.
[quoted text clipped - 28 lines]
>>>> Many thanks.
>>>> Kathy
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.