Wrong respond from Shell

petko

Registered User.
Local time
Today, 18:45
Joined
Jun 9, 2007
Messages
89
I would need some help in the following question:

From a database I open another database with the following lines:

Dim strDB As String
Dim strCmd As String
Dim objSecuredDB As Access.Application

strDB = "\\Compaq3\Ugyvitel\Elokeszites.mdb"
strCmd = SysCmd(acSysCmdAccessDir) & "\MSAccess.exe " _
& strDB

Call Shell(strCmd, vbNormalFocus)


The help says Shall returns some number if opening the target is done succesfully. If not than it is supposed to return zero.
However I experienced so that if Compaq3 is not available on the network the Shell function still returns me some number and not zero.

I'd like to have some feedback if the opening was really succesful or not because some flags should be changed accordingly. Do you have some idea how I could have that feedback easily?

Appreciating your help

Peter
 
Simple Software Solutions

Are you trying to open a secure database (as your objSecureDB suggests)?

Why not first check to see if the user can see the mdb prior to attempting the shell comand

If Dir("\\Compaq3\Ugyvitel\Elokeszites.mdb") <> "" then

....Shell()

Else

Msgbox "Cannot find..."

End If


CodeMaster::cool:
 
Hi DCrake,

Thanks a lot for the simple solution.
I did not know Dir. Only problem is that when the network is not available than Dir("\\Compaq3\Ugyvitel\Elokeszites.mdb") gives an error message. But I can handle it as a simple error occurrence.

Thanks

Peter
 

Users who are viewing this thread

Back
Top Bottom