Launching Application?? (1 Viewer)

PCandNetworking

New member
Local time
Yesterday, 21:10
Joined
Dec 17, 2002
Messages
5
Ok, I'm a newbie.

I'm using Access 2002. (XP)

I know how to launch an application using a Query, and have a command button when pressed launch it.

The question is, can I have this application launch in a SubForm?? Is this even possible?

So for example:


BUTTON 1
BUTTON 2
BUTTON 3..............................................SUBFORM
BUTTON 4
BUTTON 5


Each button would launch a different application in the SubForm.
 

ghudson

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 8, 2002
Messages
6,194
I know how to launch an application using a Query, and have a command button when pressed launch it.
I would be interested in seeing how you launch an application from a query. By "application"... Are you referring to an Access database file *.mdb or another program *.exe?
 

PCandNetworking

New member
Local time
Yesterday, 21:10
Joined
Dec 17, 2002
Messages
5
ghudson said:
I would be interested in seeing how you launch an application from a query. By "application"... Are you referring to an Access database file *.mdb or another program *.exe?

oops, my bad. I meant Macro, not Query.


What I want to launch is acctually a saved session for mmc.exe

The file is in a .msc format.

So first question is, how can I launch the .msc directly, or will I have to launch mmc.exe, then through mmc.exe open the .msc file?

Then back to the original question: Can I launch that in a SubForm?

Thanks
 

ghudson

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 8, 2002
Messages
6,194
You can open a specific file for a program using the same method as my example of the Shell function. This will open Excel from where the program is installed on my PC using the file Test.xls located at C:\Temp\

Call Shell("C:\Program Files\Microsoft Office\Office\Excel.exe C:\Temp\Test.xls", vbMaximizedFocus)

Just program your command button in your sub form.
 

SAK

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 5, 2003
Messages
43
Launch App

Howdy ghudson, a bit late but I'd like to jump in here. I set up a function to run on your guidelines as per:

Call Shell("C:\Program Files\Microsoft Office\Office\Excel.exe C:\Temp\Test.xls", vbMaximizedFocus)

Modified to my situation, I run the code and my application starts up, but not the specific file. I am starting an app called ArcMap (GIS stuff) and the file I want to open has the appropriate .mxd extension. I suspect something wrong in the second part that call/goes to the specific file I want to view.

Any suggestions?

Thanks

SK
 

ghudson

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 8, 2002
Messages
6,194
Instead of posting my code sample, you should post the code you used to call the shell command for us to review and help you solve your problem.

Also, can you open the .mxd file from Windows Explorer?
 

SAK

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 5, 2003
Messages
43
Code to launch app and associated file

Thanks for responding. Here's that code:

Shell "C:\arcgis\arcexe83\bin\ArcMap.exe C:\Documents and Settings\skleiner\My Documents\gis\SGLs\420 GIS\420GIS.mxd", vbMaximizedFocus

After Shell...the code is one continuous line in the module with no second line.

Yes, the *.mxd app will start from Windows Explorer

Thanks
 

ghudson

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 8, 2002
Messages
6,194
You forgot the () around your shell string...

Code:
Call Shell("C:\arcgis\arcexe83\bin\ArcMap.exe C:\Documents and Settings\skleiner\My Documents\gis\SGLs\420 GIS\420GIS.mxd", vbMaximizedFocus)
 

SAK

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 5, 2003
Messages
43
ghudson, thanks for posting that. I inserted that code and now I get a different response, in particular, the message states the file I want to open can't be found.

Interestingly, the error message I get is showing a file path that is not exactly what the code indicates to look for.

Unfortunately, our IT wizards want me to bring in my notebook for some upgrades so it will be a couple weeks before I have it back to explore the situation further. Which I will do then.

Thanks again for responding.
 

SAK

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 5, 2003
Messages
43
Run Shell

ghudson, if you're out there, I'd like to follow up where I left off wherein I am trying to launch an ArcMap application and a specific file to that app.

I run the following code and get an error message that the file can not be found.

The code I used is:

Public Function RunArcMap()

Call Shell("C:\arcgis\arcexe83\bin\ArcMap.exe C:\Documents_and_Settings\skleiner\My_Documents\gis\SGLs\420_GIS\420GIS", vbNormalFocus)

End Function

I am attaching a document that the screen error is shown via PrintScreen.

Thanks
 

Attachments

  • Doc1.doc
    51.5 KB · Views: 146

ghudson

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 8, 2002
Messages
6,194
Do you really have a directory named "Documents_and_Settings"? Windows XP has spaces in that directory name. The function will only work if the directory and file exists and your code looks suspect because of the underscores "_" instead of spaces in the directory and file names.

Some PC's have a problem with the spaces in the Shell command. If that is the case then you will have to use the old truncated DOS names like...

Call Shell("C:\arcgis\arcexe83\bin\ArcMap.exe C:\Docume~1\skleiner\MyDocu~1\gi s\SGLs\420_GIS\420GIS", vbNormalFocus)
 

SAK

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 5, 2003
Messages
43
Launch App

ghudson, very observant.

I tried using the actual directory string, with spaces in Win XP Pro, and the error message never even got close to the actual path, and showed the file string error as c:\Document.mxd. Taking a stab, I added the underscores to and got, at the least, an extended string that showed the full path that I sent in that attachment.

I then tried relocating my *.mxd file directly in the C drive, in a test folder, and tried this Call (Shell C:\arcgis\arcexe83\bin\ArcMap.exe C:\test\420GIS", vbNormalFocus) thinking the spaces or underscores were the problem. That didn't work either. The error message didn't like the file path again.

I never studied DOS, graduating directly from the Commodore 64 to Windows 3.*, but I understand the concept you offered.

Plan B here will be to use the DOS truncated string and see what happens then.

I will let you know how that works out.

Thanks
 

SAK

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 5, 2003
Messages
43
May I " you on that?

Found elsewhere herein the coding solution to my question.... Needed more quotes.

Option Compare Database
Option Explicit


Public Function RunArcMap()
Call Shell("C:\arcgis\arcexe83\bin\ArcMap.exe ""C:\Documents and Settings\skleiner\My Documents\gis\SGLs\420_GIS\420GIS""", vbNormalFocus)

End Function

Thanks
 

ghudson

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 8, 2002
Messages
6,194
Interesting that the extra quotes were neccessary but I am glad you solved your problem.
 

SAK

Registered User.
Local time
Yesterday, 21:10
Joined
Jun 5, 2003
Messages
43
App Launch

ghudson, thanks much for your help, I was encouraged to keep digging by your communications. Now I have another related question, and I think I will start a new post on this one. Now I need to get that file name into "relative" file path, not on a server but to allow burning the package on a CD and distributing to my coworkers. Probably post that under the VBA section...
Thanks again
 

Users who are viewing this thread

Top Bottom