Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell() specifics... 1

Status
Not open for further replies.

Robotron

Programmer
Mar 16, 2004
72
US
I am using the following code to open an access database with the Shell function...

Code:
Private Sub cmdOpenDatabase_Click()

    Dim strPath As String
    Dim RetVal As Double

    strPath = "c:\progra~1\micros~2\office10\msaccess.exe " & Me.Location
    RetVal = Shell(strPath, 1)
    
End Sub

I get an error when Me.Location = "D:\Documents and Settings\tex1pde\My Documents\EmpCencus.mdb"

I believe it has something to do with the spaces in 'Documents and Settings' and 'My Documents'. Any help appreciated.

Phil Edards
 
I thought about this over the weekend. I probably shouldn't post at 5 pm Friday. I agree your code is more robust and I will use it in my app. Thanks for your input.

PS. Love your tagline SiJP.

Phil Edwards
 
*grin*

------------------------
Hit any User to continue
 
Hi,

Why not use Office automation to open an access DB :

On Error GoTo HandleError
Dim appAccess As Access.Application

Set appAccess = New Access.Application
With appAccess
.OpenCurrentDatabase strDest
.CloseCurrentDatabase
End With

ExitHere:
On Error Resume Next
appAccess.CloseCurrentDatabase
Set appAccess = Nothing
Exit Function

HandleError:
msgbox Err.Description
Resume ExitHere
End Function
 
Doesn't work the way you think it does. I want to open it up on the screen so I can do whatever inside the database I want to open.

Phil Edwards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top