?
Solved

Access 2007 programmatically create a desktop database shortcut with made icon

Posted on 2009-04-25
5
Medium Priority
?
840 Views
Last Modified: 2013-11-27
Im using Access 2007.
 I changed my Dbs default icon in the Application Options. It work fine in the forms view and when the Db is open the icon show as intended in the bottom Window tool bar. My question is; how can I change the icon of the database when making a short cut to the desktop? Im getting ready to distribute a Db that I what it to be distinctive to the user endless list Access Dbs shortcuts. Can this be done programmatically?  
0
Comment
Question by:Exl04
  • 3
5 Comments
 
LVL 3

Accepted Solution

by:
prachwal earned 1500 total points
ID: 24232833
use WScript object to create shortcut
Sub t()
 
    Dim WshShell As Object
    Dim oShellLink As Object
 
    Set WshShell = CreateObject("WScript.Shell")
    strDesktop = WshShell.SpecialFolders("Desktop")
    Set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
    oShellLink.TargetPath = "c:\application\database.mdb"
    oShellLink.WorkingDirectory = "c:\application\"
    oShellLink.WindowStyle = 1
    oShellLink.Hotkey = "CTRL+SHIFT+F" 'if you need
    oShellLink.IconLocation = "notepad.exe, 0" ' icon or file with icons and number
    oShellLink.Description = "Shortcut Script"
    oShellLink.Save
 
    Set oShellLink = Nothing
    Set WshShell = Nothing
 
End Sub

Open in new window

0
 
LVL 1

Author Comment

by:Exl04
ID: 24233706
prachwal:
Thanks for you idea. How can I apply this script? If I put a command button in the main database switchboard some this like "Create a Shortcut to this Db in Your Desktop" can it run from there? And if the shortcut already exists will it create another one?
On this line;
oShellLink.IconLocation = "notepad.exe, 0" ' icon or file with icons and number
if I created my own icon, can I just put the path of where it is? And what does number means?
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24248538
Hi Exl04,

Have a look at the following:
http://www.windowsdevcenter.com/pub/a/windows/2004/04/13/VB_Shortcuts.html?page=2

Good Luck!

Gary
0
 
LVL 1

Author Comment

by:Exl04
ID: 24400101
tbsqadi, thanks for the information. I still can see how to make it work.  How can I make it happen from the database? Does anybody have an example code or another link of how is done?
0
 
LVL 1

Author Closing Comment

by:Exl04
ID: 31574541
Thank for you input
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question