473,890 Members | 1,354 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Open an External Program from MS Access

12 New Member
Hello everybody,

I have a database with a set of files related to each record containing relevant information about them. When these files are xls or doc files, I have no problem to store them as an hyperlink and make MA opening them when clicking, let's say a command button on a form.

However, there is an specific file type, which belongs to a 'private' software of signal processing. So, storing the file (which is actualy a folder) as an hyperlink is not enough. I was wondering if there is the posibility, similary as done with other standard programs, to open than program by clicking a command button and make it open the file-folder of each subject, which could be stored probably as 'Attached Files'(?). This function would be used with visualization purposes, given the facility of use of the mentioned program to plot signals and assess them.

I would like to thank in advance any suggestion or clue for doing this. Also, if somebody knows that it is impossible to do such thing, I will appreaciate the warning not to waste the time trying to program it.

Thanks again!
Nov 28 '11
16 15384
DamePique
12 New Member
Sorry for the delay in the communication, for several reasons I had to stop for a moment with the database. Well, as you predicted, NeoPa, using SendKeys() is not the most efficient solution for what I wanted to do (opening an external program from MS Access).

The fact is that this solution worked perfectly in my PC, but when I tried to use the Database in another PC, it didn't work. Simply, Windows (I guess) was not performing the key-sequence I programmed.

I checked whether the key sequence for opening and loading the file I wanted was the same in the second computed, and effectively it was, so that was not the problem.


I'm wondering if the problem arises in switching from Windows Vista (my PC) to Windows XP (Second PC). Any idea??

However, could you give me any good link or a clue for learning how to use the CMD file you were mentioning? I guess that would definetively solve any incompatibility .

Thanks again,
Dec 13 '11 #11
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
As I understand it the issue with SendKeys is that it can be unreliable, for instance if the receiving window is not ready to receive input, or if the focus is shifted (by the impatient user clicking another window to read his mail for instance). SendKeys as I understand is essentially similar to "faking" user keyboard input.
Dec 13 '11 #12
NeoPa
32,584 Recognized Expert Moderator MVP
Typing CMD /? from a Command Line will give you more than you need for using CMD files. Most of it can be ignored though. Essentially a CMD file, just like the BAT (batch) files before it, is a file which lists commands in order of execution. If you can determine exactly what you want run then putting that into a CMD file is fairly straightforward , but I could certainly help with it as long as you can express exactly what you want clearly enough.
Dec 13 '11 #13
DamePique
12 New Member
Well, I essentially need to know how to generate a CMD file (is that a txt file to be executed?) and how to make it execute from a Command Button in MS Access.

I will try to explain what I want to do so maybe you can give me a hand (again). Basically when pushing the command button [View File] in a report, Windows should:
1. Open the Program: Open ProF Software (which can be located in a different directory according to the user computer)
2. Load the Pathway of the file of a subject Load a given the signal (PSGFile) corresponding to the patient from whose Report the Command Button has been pressed in the ‘Open File’ Windonw for ProF Program
Tip: In the database, there is a table storing for each patient/record a string in the Field PSGFilePath with the pathway where the PSGFile of that patient is located.

3. Load & Open the signal in the Program: Open that Signal in the ProF program for visualization purposes
How the program works?
1. Open File Window: When you open the ProF program, by let’s say, double clicking on its fast access button, a second window (an ‘Open file’ window) pops up by default over the ProF window.
Note: The ‘Open File’ window has a list-box ‘Select File’ where last opened file is loaded by default
Tip: Ctrl + O has the de same effect
2. Select File Window: The user needs to click the […] button in the ‘Open File’ window and a third window pops up (Select File).
Note: The third window consists on a ‘Select File’-like navigation-panel where a list with the allowed files located in the last-opened folder is shown and a text box to introduce the desired file pathway.
The user has 2 options:
a) Select manually from the navigation panel the desired file and click OK
b) Introduce manually in the text box the pathway where the desired file is located and click OK
Tip: ProF Opens Folders (instead of files) whose names finish with .BP extension
3. The third window closes (‘Select File Window’)
4. Load Pathway The focus returns to the second window and the selected Folder in step 2 is loaded (‘Open File’ Window)
Note: The list-box in the ‘Open File’ window now displays the selected folder in step 2

5. Confirm Selection: The user needs to select the just-loaded Folder in that list-box by clicking on it with the mouse and then press [OK]
6. Load File and Plot: ProF loads and plots the signals.


I hope I have been clear enough so you can make a clear image or how the program behaves and what I want to do. Any other suggestions are welcome. As always, thanks again for your help!
Dec 14 '11 #14
NeoPa
32,584 Recognized Expert Moderator MVP
When running from Access, you want to pass a path to the software such that it goes directly to the correct patient without asking the operator to select it.

So, you need to find the syntax of the command that runs the ProF software and which allows you to tell it which folder to start in. Often, this is passed as a simple parameter, but each software package can handle this any way it chooses to, and I know nothing about this particular software. That means you need to find out how it should be done. I will give you an example showing how it would work assuming it is passed as a simple parameter, and you can take it from there.

Also, some software will only run correctly when opened from a particular folder. You need to include this in the information you provide as it will effect the CMD file. I will set it up with a dummy path to make it easy to change for you when you know what that folder is.

Command File = [ProF.CMD]
Expand|Select|Wrap|Line Numbers
  1. @ECHO OFF
  2. IF .%1==. GOTO ERR1
  3. CD /D "%ProgramFiles%\ProF"
  4. ProF.Exe %1
  5. GOTO EXIT
  6. :ERR1
  7. ECHO Error: No Patient folder passed.
  8. :EXIT
  9. ECHO ON
  10. @EXIT /B
Lines #3 and #4 may need amending depending on what you find, but your shell line (in your Access VBA) should read something like :

Expand|Select|Wrap|Line Numbers
  1. Call Shell("{Use your folder here}\ProF.CMD """ & Me.PSGFilePath & """")
Dec 14 '11 #15
DamePique
12 New Member
Fantastic!! After a deep analysis of the program, finally it worked perfectly! Thank you very much once again!

It's time to move to the next topic in MS Access...
Dec 22 '11 #16
NeoPa
32,584 Recognized Expert Moderator MVP
Good for you:-)

It's not everyone that can work successfully in this area so give yourself a slap on the back (or get someone else to do it for you if you can't reach).
Dec 22 '11 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1404
by: Ana | last post by:
Hi! I have problems with the following scenario: My application is developed using C# under .NET. It must run on all Windows versions starting from Windows 98. The user must open different documents (txt, MS Office files, pdf, pictures,…) from inside my app. It must start the file with the adequate external program (Notepad, MS Office programs, Acrobat Reader, some Picture viewer,... ) and be notified when this programs closes the...
10
8276
by: Sanyi Benczik | last post by:
Is there a standard way in C++ to call an external program or is this platform dependent? If it is platform dependent, can somebody drop a line what to use or where to look for info for GNU C++ on RedHat? I am doing some numerical calculations and need to invoke an external plotting program (gnuplot) and return to the numerics. Sorry if I posted twice.
5
9021
by: | last post by:
Maybe I ask something OS depended but maybe not. So I ask: I want to run an external program from my C++ program. I want stdin of external program constructed from a C++ string in my program. I want stdout of external program constructs a C++ string in my program. Is this possible without intermediate temporary files?
8
32679
by: Greg Fierro | last post by:
I would appreciate any help from anyone with the following: I have an external program (window32 based) that I am executing with the VBA SHELL command. This program produces a text file which I have to read after the external program finishes. I use the transfertext method to read the file. The problem is that the SHELL command executes external programs in an asynch way. In other words, the VBA code will continue running and NOT...
2
1274
by: Ryan | last post by:
System.Diagnostics.Process.Start("http://www.yahoo.com") This code works fine in VB.NET using Windows XP it opens up the default Internet Browser but when I use Windows 2000 with this code it pops up an error Message "The system cannot find the file specified" My Windows 2000 OS has same browser as the XP but I think with diff version. Is there any other way to open my default internet browser throught VB.NET code with web site...
3
4068
by: C Williams | last post by:
I am using Visual Studio 2003 and trying to use the "Start External Program" option to start Excel when I run the program. What happens is that Excel opens and then immediately closes. I know that in the past it has opened and stayed open, and I am wondering what I have inadvertently changed and how I can change it back. Thanks, -Casey
0
1001
by: nielsh | last post by:
Hello all of you. I have a little big problem. I have made a little program that starts an external program (Acrobat). When the program has loaded i use the sendkeys method to make the actions i want to do. When i test my application, it works fine, but when I try it on a different computer where Acrobat also installed, the program works , but gives no output...
8
2225
by: Keith French | last post by:
I am trying to launch an external program within Visual Basic 2005 Express. If it is a simple program it works well with:- myProg = "C:\MyFolder\MyApp.exe" System.Diagnostics.Process.Start(myProg) However, the application in question needs various command line arguments added when it is launched, such as:- "C:\MyFolder\MyApp.exe -h 9 -r 55 -j testfile.abc"
4
20150
by: My SQL | last post by:
Hi Can I trigger an external program to run when a new record is added to the mysql table? The external program is in C and instead of scanning the table continuously for new insertions, it will be better if an external program could be triggered. Any suggestions?
0
1386
by: jfigueiras | last post by:
>I have a problem with the module subprocess! As many other programs... I'm not sure what you mean by "non-standard file descriptors". The other program is free to open, read, write, etc any file he wants - are you trying to trap any file operation it may want to do? You *could* do such things -google for "code injection" and "API hooking"- but I doubt it's what you really want.
0
9980
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9829
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11236
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10926
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7172
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6064
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4278
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.