Open a program and program file from Access VBA

M

Mr. Smiley

OK. First off, I am wanting to know if this can even be DONE :) I am
wanting to program a command button on a form to open another application and
then run a file pertaining to that application based on the "part number"
value in a field on a form. I know that command buttons can be programmed to
open applications using the command button wizard. However, (an this is just
my train of thought), can VBA take the value from the part number field, then
look into a specified folder (or two) and find the file to open? Any help on
this is most appreciated. Thanks :)
 
D

Douglas J. Steele

Yes, VBA can take a value and search. How you do it, though, depends on what
you're trying to do.

Are you looking for a file that contains that part number as part of its
name, or are you looking for a file that has that part number in its
content?
 
S

storrboy

OK. First off, I am wanting to know if this can even be DONE :) I am
wanting to program a command button on a form to open another application and
then run a file pertaining to that application based on the "part number"
value in a field on a form. I know that command buttons can be programmed to
open applications using the command button wizard. However, (an this is just
my train of thought), can VBA take the value from the part number field, then
look into a specified folder (or two) and find the file to open? Any help on
this is most appreciated. Thanks :)


See if this fits your needs.

http://www.mvps.org/access/api/api0018.htm
 
M

Mr. Smiley

The value in the part number field is also part of the name of the file
associated with it.
 
M

Mr. Smiley

I am unsure about where to put these sections of code. Do I place it all
behind a command button? Or a module?
 
M

Mr. Smiley

The program is called InSpec. It is a metrology software.

The user goes through a couple of forms until they get to one that has a
list of part numbers. Beside of each part number there will be a command
button that says "Run program". Upon pressing this button, Access would then
take the part number beside of the command button and go to the folder
holding it's associated file. The part number is in the name of each file.
 
M

Mr. Smiley

Douglas, your Public Sub FindMP3FilesUsingDir function looks promising, but I
have the hardest time figuring out where to put each section of code. Should
this be in a separate module, or behind a command button? I apprecaite your
help :)
 
D

Douglas J. Steele

Put it in a separate module (make sure you don't name the module the same as
any of the routines in it!)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top