Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 12th, 2005, 08:34 PM
Lauren Quantrell
Guest
 
Posts: n/a
Default Create Shortycups in MS-Access ADP

I used to use this code to create shortcuts in my Access Jet MBD
programs but it won't work in Access ADP projects. I know it's related
to reference to CurrentDB.Properties (where it errors). IS there an
equivalent to do this in an ADP???
Any help is appreciated.
lq

Private Function CreateShortcut(myPath As String, myDest As Long,
dDrive As String)

Dim WScript As Object, myShortcut As Object, Sc As String
Set WScript = CreateObject("WScript.Shell")
Sc = GetSpecialFolderLocation(myDest)
Set myShortcut = WScript.CreateShortcut(Sc & "\NewsBase" & ".lnk")
myShortcut.TargetPath = myPath

On Error GoTo err_IconomyShortcut

myShortcut.IconLocation = CurrentDb.Properties("AppIcon")
myShortcut.WorkingDirectory = dDrive & ":\NewsBase"
myShortcut.Save

exit_CreateShortcut:
Set myShortcut = Nothing
Set WScript = Nothing
Exit Function
err_IconomyShortcut:
If Err.Number = 3270 Then
myShortcut.IconLocation = SysCmd(acSysCmdAccessDir) &
"\msaccess.exe, 1"
Resume Next
Else
MsgBox Err.Description
GoTo exit_CreateShortcut
End If
End Function
  #2  
Old November 12th, 2005, 08:35 PM
Fletcher Arnold
Guest
 
Posts: n/a
Default Re: Create Shortycups in MS-Access ADP

"Lauren Quantrell" <laurenquantrell@hotmail.com> wrote in message
news:47e5bd72.0402190736.2e5680d1@posting.google.c om...[color=blue]
> I used to use this code to create shortcuts in my Access Jet MBD
> programs but it won't work in Access ADP projects. I know it's related
> to reference to CurrentDB.Properties (where it errors). IS there an
> equivalent to do this in an ADP???
> Any help is appreciated.
> lq
>
> Private Function CreateShortcut(myPath As String, myDest As Long,
> dDrive As String)
>
> Dim WScript As Object, myShortcut As Object, Sc As String
> Set WScript = CreateObject("WScript.Shell")
> Sc = GetSpecialFolderLocation(myDest)
> Set myShortcut = WScript.CreateShortcut(Sc & "\NewsBase" & ".lnk")
> myShortcut.TargetPath = myPath
>
> On Error GoTo err_IconomyShortcut
>
> myShortcut.IconLocation = CurrentDb.Properties("AppIcon")
> myShortcut.WorkingDirectory = dDrive & ":\NewsBase"
> myShortcut.Save
>
> exit_CreateShortcut:
> Set myShortcut = Nothing
> Set WScript = Nothing
> Exit Function
> err_IconomyShortcut:
> If Err.Number = 3270 Then
> myShortcut.IconLocation = SysCmd(acSysCmdAccessDir) &
> "\msaccess.exe, 1"
> Resume Next
> Else
> MsgBox Err.Description
> GoTo exit_CreateShortcut
> End If
> End Function[/color]



Where do you now hope to store your IconLocation? In a SQL server table, or
in a location fixed relative to the adp? If so you could look at
CurrentProject.Path which gives the folder where the adp is. You can
navigate from there.

Fletcher






  #3  
Old November 12th, 2005, 08:48 PM
Lauren Quantrell
Guest
 
Posts: n/a
Default Re: Create Shortycups in MS-Access ADP

Fletcher,
I realized this after posting it that it simply refers to the location
of the icon file. I was thinking something else.
Regards,
lq

"Fletcher Arnold" <fletch@home.com> wrote in message news:<c12o09$fpr$1@hercules.btinternet.com>...[color=blue]
> "Lauren Quantrell" <laurenquantrell@hotmail.com> wrote in message
> news:47e5bd72.0402190736.2e5680d1@posting.google.c om...[color=green]
> > I used to use this code to create shortcuts in my Access Jet MBD
> > programs but it won't work in Access ADP projects. I know it's related
> > to reference to CurrentDB.Properties (where it errors). IS there an
> > equivalent to do this in an ADP???
> > Any help is appreciated.
> > lq
> >
> > Private Function CreateShortcut(myPath As String, myDest As Long,
> > dDrive As String)
> >
> > Dim WScript As Object, myShortcut As Object, Sc As String
> > Set WScript = CreateObject("WScript.Shell")
> > Sc = GetSpecialFolderLocation(myDest)
> > Set myShortcut = WScript.CreateShortcut(Sc & "\NewsBase" & ".lnk")
> > myShortcut.TargetPath = myPath
> >
> > On Error GoTo err_IconomyShortcut
> >
> > myShortcut.IconLocation = CurrentDb.Properties("AppIcon")
> > myShortcut.WorkingDirectory = dDrive & ":\NewsBase"
> > myShortcut.Save
> >
> > exit_CreateShortcut:
> > Set myShortcut = Nothing
> > Set WScript = Nothing
> > Exit Function
> > err_IconomyShortcut:
> > If Err.Number = 3270 Then
> > myShortcut.IconLocation = SysCmd(acSysCmdAccessDir) &
> > "\msaccess.exe, 1"
> > Resume Next
> > Else
> > MsgBox Err.Description
> > GoTo exit_CreateShortcut
> > End If
> > End Function[/color]
>
>
>
> Where do you now hope to store your IconLocation? In a SQL server table, or
> in a location fixed relative to the adp? If so you could look at
> CurrentProject.Path which gives the folder where the adp is. You can
> navigate from there.
>
> Fletcher[/color]
 

Bookmarks

Thread Tools

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles