473,480 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Shortcut to mdb...

I'm trying to make a shortcut that will open an mdb in the same folder as
the shortcut - regardless of where the file/shortcut may be. In other
words, I want to be able to copy and paste the two files anywhere and have
the shortcut always open the mdb that was copied with it without having to
change the shortcut properties. If I only use the mdb name without any
path, the shortcut tries to look in the folder where msaccess.exe is. I've
tried:

%cd%\MyDB.mdb
\MyDB.mdb
MyDB.mdb

None work.

Does anyone know how to do this?

Thanks.
--
Matthew.Wells
Ma***********@FirstByte.net
Aug 3 '08 #1
10 3520
I'm trying to make a shortcut that will open an mdb in the same folder as
the shortcut
if the person's going to be in the folder, what is the benefit of clicking
on the mdb file vs a shortcut in that folder? (I must be missing something
here).
In other words, I want to be able to copy and paste the two files anywhere
and have the shortcut always open the mdb that was copied with it without
having to change the shortcut properties.
I don't believe the above is possible, no more then having shortcut "know"
where you moved the file. On the other hand, what benefit is it to click on
the shortcut in the folder vs that of the actual mdb file? I guess I missing
a BIG issue here.

Now, if you talking about launching/running another mdb in the same folder
with vba code, then that's easy..but your asking for a shortcut which is a
grand canyon of difference of a question......

Why not click on the mdb file in place of a shortcut?
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Aug 3 '08 #2
The Access version path and workgroup name are specified. These can change
depending on the MDB that's opened.
"Albert D. Kallal" <Pl*******************@msn.comwrote in message
news:Sxllk.111857$kx.35721@pd7urf3no...
>I'm trying to make a shortcut that will open an mdb in the same folder as
the shortcut

if the person's going to be in the folder, what is the benefit of clicking
on the mdb file vs a shortcut in that folder? (I must be missing something
here).
>In other words, I want to be able to copy and paste the two files
anywhere and have the shortcut always open the mdb that was copied with
it without having to change the shortcut properties.

I don't believe the above is possible, no more then having shortcut "know"
where you moved the file. On the other hand, what benefit is it to click
on the shortcut in the folder vs that of the actual mdb file? I guess I
missing a BIG issue here.

Now, if you talking about launching/running another mdb in the same folder
with vba code, then that's easy..but your asking for a shortcut which is a
grand canyon of difference of a question......

Why not click on the mdb file in place of a shortcut?
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com


Aug 3 '08 #3
"Matthew Wells" <Ma***********@FirstByte.netwrote in message
news:S7******************************@comcast.com. ..
The Access version path and workgroup name are specified. These can
change depending on the MDB that's opened.
Right, but can/are you trying to use vba to launch the mdb file, or a
shortcut?

As I said, with vba, this is easy, but you not clarified if you actually
need a shortcut, or in fact you can/are willing to run vba code to launch
the other mdb file?

An actual shortcut is quite problematic since even the location of the
msaccess.exe can change, let alone the path to the mdb file.

However, as mentioned, if you using vba here, then no problem....
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Aug 3 '08 #4
The exe location will not change. Why would I use vba? Someone else
suggexted I use a batch file since the %cd% variable would be available
then. This would work easily, but I want to stick with the shortcut as we
already have the appropriate group policies in place for it. It would be
much easier to change the shortcut properties than to change the policies.
We are a public company and have SOX compliance issues.
"Albert D. Kallal" <Pl*******************@msn.comwrote in message
news:U0mlk.157849$gc5.5719@pd7urf2no...
"Matthew Wells" <Ma***********@FirstByte.netwrote in message
news:S7******************************@comcast.com. ..
>The Access version path and workgroup name are specified. These can
change depending on the MDB that's opened.
Right, but can/are you trying to use vba to launch the mdb file, or a
shortcut?

As I said, with vba, this is easy, but you not clarified if you actually
need a shortcut, or in fact you can/are willing to run vba code to launch
the other mdb file?

An actual shortcut is quite problematic since even the location of the
msaccess.exe can change, let alone the path to the mdb file.

However, as mentioned, if you using vba here, then no problem....
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com


Aug 3 '08 #5
"Matthew Wells" <Ma***********@FirstByte.netwrote in message
news:L7******************************@comcast.com. ..
The exe location will not change.
Might be your case, but then again why not code something that will work
when the user has a non standard install location...and this especially
happens with a2003 runtime, or in the case that they installed into a
different folder. I mean, ***why*** would you not using something that more
flexible then a hard coded path that can change? It would a VERY silly idea
to choose a hard coded path to msaccess.exe if you can get the path on the
fly. (not a big deal either way, but when using vba, it no more work to get
the actuall path).
Why would I use vba?
Because vba makes the whole problem trivial. I not really telling you to use
vba, I simply asking what you are trying to do, and ***can*** you consider
using vba (since this is a walk in the park).

So, I am actually asking **can** you use vba here?
Someone else suggexted I use a batch file since the %cd% variable would
be available then.
Well, it was not me, and it not clear what your trying to do here...

So, a batch file for what? Who is running that batch file? What is it going
to do? Is this to be run from access? As I said if this can be a mdb/mde
file they click on then this is quite easy. It just not clear if you do in
fact need a batch file (and batch files are not a ms-access question
anyway).

I don't have an answer for using dos batch files, but if we are taking about
VBA, then I can dig up a solution for you. We just have to determine if you
MUST use batch file + shortcut (and, if you must use a batch file then me
digging up some vba is going to waste both yours and my time).

All of this info such as the current path, path to msaccess.exe and even the
path to the currently joined workgroup file is easily obtained in ms-access,
but not so much in batch files.
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Aug 3 '08 #6
Perhaps I not grabbing what you want to do.

However, here is how from inside of ms-access you can launch another
application (in the same dir), and also specify he location of ms-access and
also the workgroup file...
Function JumpToUpGrade2() As Boolean

' jumps to a mde file called "upgrade"
' it exists in the same directly as the currently running program

Dim strExe As String
Dim strShellProg As String
Dim strCurrentDir As String
Dim strDB As String
Dim strWorkGrp As String
Const q As String = """"

Dim fhand As Integer
Dim strCopyFile As String
Dim strRidesini As String
strDB = CurrentDb.Name

strCurrentDir = CurrentProject.Path & "\"

'get path to msaccess.exe
strShellProg = q & SysCmd(acSysCmdAccessDir) & "msaccess.exe" & q
' we will shell out to RidesUpGrade.mde
strShellProg = strShellProg & " " & q & strCurrentDir &
"RidesUpGrade.mdE" & q
' get workgroup file
strWorkGrp = q & SysCmd(acSysCmdGetWorkgroupFile) & q

strShellProg = strShellProg & " /wrkGrp " & strWorkGrp
If Shell(strShellProg, vbNormalFocus) 0 Then
Application.Quit
Else
MsgBox "Un able to run Rides upgrade", vbCritical, AppName
Application.Quit
End If
End Function
So, the above shows how you can grab the current path of the current running
application (get your dir).

eg:
strCurrentDir = CurrentProject.Path & "\"

path to ms-access.exe

strShellProg = q & SysCmd(acSysCmdAccessDir) & "msaccess.exe" & q

path to workgroup
strWorkGrp = q & SysCmd(acSysCmdGetWorkgroupFile) & q

However, as mentioned, if you must use a batch file, then all of the above
is simply not going to help you....

However, if you are looking to launching something from the same dir via
ms-access then the above info should be just the ticket you are looking
for...

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Aug 4 '08 #7
"Matthew Wells" <Ma***********@FirstByte.netwrote:
>I'm trying to make a shortcut that will open an mdb in the same folder as
the shortcut - regardless of where the file/shortcut may be. In other
words, I want to be able to copy and paste the two files anywhere and have
the shortcut always open the mdb that was copied with it without having to
change the shortcut properties. If I only use the mdb name without any
path, the shortcut tries to look in the folder where msaccess.exe is. I've
tried:
FWIW the Auto FE Updater can, essentially, do all this for you and copy down new
versions of the FE when you make them available.

Actually what it does is call the FE MDB/MDE with the appropriate command line
switches such as the work group.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Aug 5 '08 #8
I want to use a Windows shortcut. I'm not opening from within an app. We
have different environments that use the same db name (Dev, UAT, and
Production). There has been confustion on which shortcut opened which db.
We want to make sure tha tthe shortcut can only open the mdb in the same
folder as the shortcut.

I'm sorry you feel like I should justify my methodology. Do you actually
have an answer? I would appreciate it.

"Albert D. Kallal" <Pl*******************@msn.comwrote in message
news:Njslk.158813$gc5.43486@pd7urf2no...
Perhaps I not grabbing what you want to do.

However, here is how from inside of ms-access you can launch another
application (in the same dir), and also specify he location of ms-access
and also the workgroup file...
Function JumpToUpGrade2() As Boolean

' jumps to a mde file called "upgrade"
' it exists in the same directly as the currently running program

Dim strExe As String
Dim strShellProg As String
Dim strCurrentDir As String
Dim strDB As String
Dim strWorkGrp As String
Const q As String = """"

Dim fhand As Integer
Dim strCopyFile As String
Dim strRidesini As String
strDB = CurrentDb.Name

strCurrentDir = CurrentProject.Path & "\"

'get path to msaccess.exe
strShellProg = q & SysCmd(acSysCmdAccessDir) & "msaccess.exe" & q
' we will shell out to RidesUpGrade.mde
strShellProg = strShellProg & " " & q & strCurrentDir &
"RidesUpGrade.mdE" & q
' get workgroup file
strWorkGrp = q & SysCmd(acSysCmdGetWorkgroupFile) & q

strShellProg = strShellProg & " /wrkGrp " & strWorkGrp
If Shell(strShellProg, vbNormalFocus) 0 Then
Application.Quit
Else
MsgBox "Un able to run Rides upgrade", vbCritical, AppName
Application.Quit
End If
End Function
So, the above shows how you can grab the current path of the current
running application (get your dir).

eg:
strCurrentDir = CurrentProject.Path & "\"

path to ms-access.exe

strShellProg = q & SysCmd(acSysCmdAccessDir) & "msaccess.exe" & q

path to workgroup
strWorkGrp = q & SysCmd(acSysCmdGetWorkgroupFile) & q

However, as mentioned, if you must use a batch file, then all of the above
is simply not going to help you....

However, if you are looking to launching something from the same dir via
ms-access then the above info should be just the ticket you are looking
for...

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com

Aug 6 '08 #9
?????? So it's not a shortcut to the mdb but a shortcut to ms-access
with the mdb specified as a command line parameter?

On Aug 3, 1:23*pm, "Matthew Wells" <Matthew.We...@FirstByte.net>
wrote:
The Access version path and workgroup name are specified. *These can change
depending on the MDB that's opened.
Aug 6 '08 #10
"Matthew Wells" <Ma***********@FirstByte.netwrote in message
news:Ao******************************@comcast.com. ..
>I want to use a Windows shortcut. I'm not opening from within an app. We
have different environments that use the same db name (Dev, UAT, and
Production). There has been confustion on which shortcut opened which db.
We want to make sure tha tthe shortcut can only open the mdb in the same
folder as the shortcut.

I'm sorry you feel like I should justify my methodology.
I am not asking you to justify your approach, but I am simply telling you if
can use vba then I have an easy solution for you. Nothing more, nothing
less.
Do you actually have an answer? I would appreciate it.
No, I only have a vba one for you.
Why on earth would I withhold an answer? How stupid is that? I taken time to
offer you examples that work in VBA + ms-access. Unfortunately that's the
only
solution I have here for you here (sorry). And, I spend considerable time
asking you is a vba solution ok? The **reason** why I asked you if a vba
solution is ok because then I would be willing to spend the time offering
that soltuion. (not that you "must" use vba, or change your ways).

However, you were NOT forthcommming on this issue so I simply
offered the soltion and now we see it was a compliate 100% waste of my time
that could have been used to help others here. I was asking out of
respect and to save time here.

Since you can't use vba and ms-access then you asking your question in the
wrong newsgroup and you unlikey to find an answer here.

I also think you would be better off using windows scriting in place of a
shrotcut, but then again you made your restrucitons clear now.

Perahps you try some other windows support forms, but you much shooting in
the dark for a non access soltiuon by asking in a access group...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com

Aug 7 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
2834
by: aa | last post by:
Thought this question might be out of this NG's scope, there are always knowledgable people who might hava an answer. A hyperlink to a shortcut to a file returnes an empty screen, and the source...
10
2531
by: Lex | last post by:
I am writing a C# app that has a Menu. Some of the menu items will have short cuts that do not exist in the Shortcut enum. I would like the custom shortcuts to appear on the menu but as far as I...
4
8820
by: Salad | last post by:
A97. If you set a forms properties to ShortcutMenu = No, the entire form is disabled from displaying a shortcut menu. If you set the property to Yes, all controls have a shortcut menu. I have...
5
5157
by: Steven | last post by:
I have some text boxes on a form in MS Access 2000. When I right click in them I don't get any shortcut menu at all. I want the normal cut, copy, and past menu to come up. In the "Startup", I...
0
3519
by: cefrancke | last post by:
I recently discovered, that if you set the startup options for "security", you will have alot of work do to get Access back to "normal". If you disable the built-in menus/toolbars you'll have to...
0
2739
by: Marcel | last post by:
Hi, the application I am writing has a MainMenu and a DataGrid (UltraGrid). Now I have to edit the text of each cell in this grid. So far so good. All works fine in editmode but if I press a...
4
4380
by: I_AM_DON_AND_YOU? | last post by:
There is one more problem I am facing but didn't get the solution. In my Setup Program I am not been able to create 2 things (when the program is intalled on the client machine ) : (1) create...
3
2139
by: TC | last post by:
I've written an application using VB.NET 2003 and packaged it with a deployment project. When I use the setup program to install the application, however, it doesn't work. More specifically, the...
7
31191
by: GrandpaB | last post by:
I would appreciate assistance learning how to create a Desktop shortcut in my setup project. In the left pane of the Setup/File System window I right-clicked User's Desktop. From the contex...
5
6479
by: remya1000 | last post by:
i'm using VB.NET 2003 application program. by using OpenFileDialog, we can select the file name or file path. OpenFileDialog1.ShowDialog() pgmPath.Text =...
0
7055
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7060
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6760
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4501
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3013
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3004
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.