If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > Access VBA & How to follow shortcut

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-20-09, 07:57
ObjectDesign ObjectDesign is offline
Registered User
 
Join Date: Oct 2009
Posts: 5
Access VBA & How to follow shortcut

Hi - I have managed to create a shortcut to an Access database with the /ro switch added to the Target line - now I would like to use Access VBA to follow the shortcut does anyone have any ideas - I have tried using the Shell to open but no joy.

Thanks in advance
Al
Reply With Quote
  #2 (permalink)  
Old 10-20-09, 08:52
Ax238 Ax238 is offline
Registered User
 
Join Date: May 2009
Posts: 257
Why not just use the Shell command on the target of the shortcut?
Code:
Shell "msaccess.exe /ro ""c:\My Folder\My Database.mdb"""
Regards,

Ax
Reply With Quote
  #3 (permalink)  
Old 10-20-09, 09:45
ObjectDesign ObjectDesign is offline
Registered User
 
Join Date: Oct 2009
Posts: 5
thanks for reply Ax - I had tried various incarnations of this but I think my quote placing is wrong - the path to the .mdb file is held in a string strFullPath keep getting file not found error though can use the same path to create a shortcut. The latest I tried was:

Shell "C:\Program Files\Microsoft Office\OFFICE11\Access.exe/ro " & strFullPath

Thanks Again
Reply With Quote
  #4 (permalink)  
Old 10-23-09, 07:28
ObjectDesign ObjectDesign is offline
Registered User
 
Join Date: Oct 2009
Posts: 5
update

well Ive got a little further forward. I can run the Shell command:
Shell ("C:\Program Files\Microsoft Office\Office11\msaccess.exe /ro")
this starts up an instance of msaccess and accepts the /ro switch.
The problem now is that when I place the path and file name I want to open in front of it - I get an error message stating that I am using an illegal switch - conatins an option that Microsoft Access doesnt recognise ?
Path and file name is "C:\My Documents\Security Gateway\MyDb.mdb"
Anyone got any ideas where I am going wrong ?
Thanks in Advance
Reply With Quote
  #5 (permalink)  
Old 10-23-09, 08:45
Ax238 Ax238 is offline
Registered User
 
Join Date: May 2009
Posts: 257
Yeah, you just have problems with quotes, this ought to do it for you:
Code:
Shell ("""C:\Program Files\Microsoft Office\Office11\msaccess.exe"" /ro ""C:\My Documents\Security Gateway\MyDb.mdb""")
In order to get double quotes in a string, you have to double them up or use the char code.

Ax
Reply With Quote
  #6 (permalink)  
Old 10-27-09, 06:31
ObjectDesign ObjectDesign is offline
Registered User
 
Join Date: Oct 2009
Posts: 5
Smile

Thanks Ax it was the quotes - working a treat now
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On