Access shortcut Executable path

mothi

Registered User.
Local time
Today, 13:22
Joined
Dec 26, 2009
Messages
111
Hi , I post a few threads earlier but i decided to take the shortcut route.

THe only question i have is that if users have access executable in different folders . I do not want to change the target path in shortcut for each user. I need some code or a batch file to recognize the access executable path So please help me out in knowing that( need some code) I do not know how to run a batch file from access ( if thats what i have to do ) . Please...........
 
You could use the FullPath property of the Access reference.
Code:
Debug.Print References.Item("Access").FullPath
 
Hi lagbolt,
I think i need to use that statement in vba. But how does it reflect the change in shortcut. Please walk me through this. thank you.
 
1) Yes that's VBA.
2) It doesn't reflect a change in anything. It answers the question you posed:
"I need some code or a batch file to recognize the access executable path "
3) Walk you through what, sorry? Do you need to change properties of a shortcut?
 
Yes the If the two users have access executable in different folders. Then i do not want to change the shortcut target property manually, I need some sort of code or a batch file to recognize the path of the access excutable and use it in the shortcut target property. Thank You. Please Help me .
 
Yes the If the two users have access executable in different folders. Then i do not want to change the shortcut target property manually, I need some sort of code or a batch file to recognize the path of the access excutable and use it in the shortcut target property. Thank You. Please Help me .

Just so you are aware - that is not a simple problem. In fact, it may be more efficient to do it manually than to try to come up with a process to do it dynamically. So, how do you propose that they open the database to begin with so the code can change the shortcut? Seems to me like a "Which came first - the chicken or the egg?" problem.
 
You might try to have your Access application create the shortcut referencing the Access executable file loacation when it is run the first time. You might need a field in a table that would hold a value that would indicate when the shortcut has been created. Check out the article at this link and see if it is helpful:
http://www.dbforums.com/microsoft-access/444529-generating-shortcut-using-access-vba.html

Okay, I want to know how you can run your SECURED Access database WITHOUT a shortcut to begin with (the user that is) in order for it to create the shortcut. That makes no sense whatsoever. You will need a SEPARATE database or program to create it because you won't be able to open the database for it to do anything if you need to start it using the MDW file as it is secured. Does that clarify anything?
 
Hi SOS,

I will create the shortcut and i will hide the main database and the assosciated mdw file.

AS you know the

target property = " C:\Program Files \Microsft Office\Office 11\ MS ACCESS.EXE" ...........

I would like access executable to be changed by looking up the users drive If the User got his access executable in Office 12 . then it should make that change in the shortcut . I do not want to do that manually by going at each users desk and doing it . So please help me ...
 
Hi SOS,

I will create the shortcut and i will hide the main database and the assosciated mdw file.

AS you know the

target property = " C:\Program Files \Microsft Office\Office 11\ MS ACCESS.EXE" ...........

I would like access executable to be changed by looking up the users drive If the User got his access executable in Office 12 . then it should make that change in the shortcut . I do not want to do that manually by going at each users desk and doing it . So please help me ...

So you'll need to create a database for them to run once and you can use the code I referenced to get the Access exe location and then you can use the code Mr. B shared the link to in order to actually build the shortcut.
 
Hi SOS,
THank you for replying in such short time . I need a littble bit more help the link you have forwarded after copying and pasting in a module how should i invoke the module . I mean where should i address it . I am a newbie so please help me out..........
 
You would call it like this in the same code that builds the shortcut:

Code:
Dim strLocation As String
   strLocation = fFindEXE(CurrentProject.Name, CurrentProject.Path)
And then you use strLocation where the code Mr. B gave needs the app location.
 
Maybe what I've proposed is too simple?
An Access.Application object has a References collection. One of these references is to the MSAccess object model. This object model is located in the Access installation folder.
In the immediate window, try ...
Code:
? Application.References("Access").FullPath
 
Well, when I run that Lagbolt, I got this:

C:\Program Files\Microsoft Office\OFFICE11\MSACC.OLB

Which I suppose you could assume that MSAccess.exe resides in the same location, but I think I'd rather be certain.
 
hi SOS, I am pasting my code could you please check because when i run the shortcut which it has created on the desktop it is opening the mdw file but not the actual database and . I running the code on the button onclick event . Please take a look at it. I hope i am very close to getting it right .



Dim WSHShell As Object
Set WSHShell = CreateObject("WScript.Shell")
Dim AccessPath As String
Dim MyShortcut As Object
Dim DesktopPath As String
Dim ClientDirectory As String
Dim MdwSwitch As String
Dim workfield As String
Dim wv1 As Variant
Dim strLocation As String
strLocation = fFindEXE(CurrentProject.Name, CurrentProject.Path)

' Read desktop path using WshSpecialFolders object

DesktopPath = WSHShell.SpecialFolders("Desktop")

AccessPath = """strLocation"""

ClientDirectory = """C:\Documents and Settings\HEALTH1\Desktop\New Folder\Testing.mdb"""

MdwSwitch = " " & "/" & "wrkgrp " & """C:\Documents and Settings\HEALTH1\Desktop\New Folder\System4.mdw"""

workfield = AccessPath & " " & ClientDirectory & MdwSwitch

' Create a shortcut object on the desktop

Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\Pasapp97.lnk")
' Set shortcut object properties and save it

'MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings("%windir%\notepa d.exe")
'MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings(workfield)

MyShortcut.TargetPath = workfield
'MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings("%windir%")

MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\Office\")
MyShortcut.WindowStyle = 5
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("strLocation, 0")
'MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("%windir%\MSACCE SS.EXE, 0")
MyShortcut.Save
Set MyShortcut = Nothing
Set WSHShell = Nothing


End Sub
 
Have you tried changing this:

AccessPath = """strLocation"""

to this:

AccessPath = strLocation

without the extra quotes. Not sure those are necessary.
But if they are then you can add them here:

workfield = AccessPath & " " & ClientDirectory & MdwSwitch

like:

workfield = Chr(34) & AccessPath & Chr(34) & " " & ClientDirectory & MdwSwitch
 
Hi SOS,

One more thing is that it is picking up the 2000version access executable . I have 2003 too so what should i do in order to make the code to grab 2003 version .
 
Sorry, but I think you may be stuck with doing it by hand then. I don't know that the code we have can determine more than one version. It may be that it returns the first it finds. So .... :(
 
Unless your USERS only have one version. Which really should be the case but I know how it can be. I once worked at a place where we had apps that had to run in Access 97 so we had the Access 97 AND Access 2000 runtimes installed.
 

Users who are viewing this thread

Back
Top Bottom