Access 2003

S

Stephen

Hello all,

So I have a simple question we are trying to add a button, so that button
open a new Access DB. I did the test on my pc, the database were on
c:\test.mdb and it's working but in real life the DB is on a share network
drive and the complete path as space. See the following :

Private Sub Commande86_Click()
On Error GoTo Err_Commande86_Click

Dim stAppName As String

stAppName = "msaccess.exe O:/DirFin/Prive/Jane International/Base
Access/stephane.mdb"
Call Shell(stAppName, 1)

Exit_Commande86_Click:
Exit Sub

Err_Commande86_Click:
MsgBox Err.Description
Resume Exit_Commande86_Click

End Sub

How can I replace the space so my DB will open, now it only get
O:/DirFin/Prive/Jane.mdb...

Any help would be appreciated

Best regards
 
S

Stephen

Thank You Daniel

But how can I include this (Application.FollowHyperlink
"O:/DirFin/Prive/Jane International/Base Access/stephane.mdb")
on my code !!!

Private Sub Commande86_Click()
On Error GoTo Err_Commande86_Click

Dim stAppName As String
stAppName = "msaccess.exe O:/DirFin/Prive/Jane International/Base
Access/stephane.mdb"
Call Shell(stAppName, 1)

Exit_Commande86_Click:
Exit Sub

Err_Commande86_Click:
MsgBox Err.Description
Resume Exit_Commande86_Click

End Sub
 
S

Stephen

Ohh I forgot I test it and I get an annoying warning (the file can contain
viruses or in other ways damage your computer) so I wonder if there is
another alternative to Application.FollowHyperlink...
 
D

Daniel Pineault

You need to encompass your filename with quotes, somthing like

Shell("msaccess.exe " & """O:/DirFin/Prive/Jane International/Base
Access/stephane.mdb""", 1)

--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
J

John W. Vinson

So I have a simple question we are trying to add a button, so that button
open a new Access DB. I did the test on my pc, the database were on
c:\test.mdb and it's working but in real life the DB is on a share network
drive and the complete path as space. See the following :

Put the path and filename in quotes. To do so inside a string already
delimited with doublequotes, double the doublequotes:

stAppName = "msaccess.exe ""O:/DirFin/Prive/Jane International/Base
Access/stephane.mdb"""
 

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