DoCmd.RunApp

Len Boorman

Back in gainfull employme
Local time
Today, 10:12
Joined
Mar 23, 2000
Messages
1,928
have searched on above but could not find anything

I want to start another database from within a database from a command button

Use the wizard option for RunApp and it appeared to work okay. definately pointing at the database.

Event procedure is

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim stAppName As String

stAppName = "msaccess.exe C:\Len\Working Database\Single Non Conformance System\Database\Secure Defect Docket Database.mdb"
Call Shell(stAppName, 1)

Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub

Getting error saying that I was trying to use an option in command line that was not recognised.

Few clicks on the OK and the error message cannot find file

Any clues please

len
 
try putting the path to the msaccess.exe i.e.

stAppName = "C:\Program Files\Microsoft Office\msaccess.exe C:\Len\Working Database\Single Non Conformance System\Database\Secure Defect Docket Database.mdb"
 
Len, I have just tried both methods of opening one of my databases and both your method and mine work in opening the database.

Dim stAppName As String

stAppName = "C:\Program Files\Microsoft Office97\Office\msaccess.exe N:\Access_Development\1_Template_Database_Do_Not_Alter\Template_Database.mdb"
Call Shell(stAppName, 1)

stAppName = "msaccess.exe N:\Access_Development\1_Template_Database_Do_Not_Alter\Template_Database.mdb"
Call Shell(stAppName, 1)

Are you sure your Db path name is correct?, because if I set Db path to something that does not exist, then I get the same error as you
 
I had already tried the full path for the exe but from you last post I have the feeling that it is to do with spaces in either the path or file name

Len

Edit

Moved database and stripped spaces from path to database and all okay. Strangely it did not object to spaces in the path to msaccess.exe
Thanks for the testing
Len
 
Last edited:
I prefer to use the ShellExecute method to open a file. It does not have the problems and limitations that the Shell() function does.

I have a working example in my Browse [Find a directory or file] sample.
 
Thanks. I have downloaded the zip and will have a look.

I am not actually browsing.

I actually have 7 applications that all deal with Quality in some manner
Defects
Audits
FRACAS
Occurrence Reporting
MEDA Investigations
Vendor Rating
Vendor Register


They all use a common data repository.

A Corporate Entry to Quality Engineering is needed so that when we are audited or want to appear really on the ball the Corporate Interface is used.


Now I could basically merge the whole lot into a single front end (leave out the data repository) but very few people use all databases

So the thought was to create a Front Front End with command buttons apparently taking you into that "Module" but actually firing a separate application. hence the RunApp

I really thinkI want to avoid a single chunky FE as I am certain that there is a whole bunch of development yet to come on a number of the modules. I also need to control by module who can use them.

Thanks to all for assistance.

Len
 
Forget the browsing stuff. Try the ShellExecute() method that my sample is using to "open" a file from the click of your command button. You just have to hard code the \path\filename part for each command button to open each mdb file.
 

Users who are viewing this thread

Back
Top Bottom