Share via

Programmatically change the application icon

Anonymous
2015-02-13T19:30:56+00:00

How can I programmatically change the msaccess property of the startup application icon for my msaccess database?

I would like my users to see a different application icon on their taskbar, depending on which startup macro launches the database. I have created different .lnk icons to launch different copies of the same database front end, but these .lnk icons switch to the access application icon after they start up.

FOR EXAMPLE:

.LNK TARGET COMMAND:  abc.mdb /x m_openquery.Calendar:

   Startup icon that is pinned to the taskbar: Calendar.ico

   Application icon: abc.ico

   Programmatically change application icon to Calendar.ico to match taskbar icon

.LNK TARGET COMMAND:  abc.mdb /x m_openquery.ActivityMemos

   Startup icon that is pinned to the taskbar: Memo.ico

   Application icon: abc.ico

   Programmatically change application icon to Memo.ico to match taskbar icon

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

18 answers

Sort by: Most helpful
  1. HansV 462.6K Reputation points
    2015-02-14T00:01:21+00:00

    You could create a function that sets the icon to Calendar.ico, and call that function from the m_openquery.Calendar macro, using the RunCode action.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2015-02-13T23:21:48+00:00

    Thank you!

    The last step is:  How do I get that code to execute ONLY IF database launches with the /x OpenQuery.Calendar macro?

    Was this answer helpful?

    0 comments No comments
  3. HansV 462.6K Reputation points
    2015-02-13T21:07:15+00:00

    To create or set a property, you only need to copy the part from

    Function AddAppProperty(strName As String, varType As Variant, _

            varValue As Variant) As Integer

    up to and including the line

    End Function

    below it into a code module in your database.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2015-02-13T20:45:47+00:00

    Thank you very much, Hans. I can't wait to try it after class. Since I am a dope, how much of the surrounding code in the link's example will I need to include?

    Was this answer helpful?

    0 comments No comments
  5. HansV 462.6K Reputation points
    2015-02-13T19:53:45+00:00

    See http://www.granite.ab.ca/access/settingstartupoptions.htm for the code needed to set and read database properties.

    The application icon is the AppIcon property. To set it, you can use code like this:

    AddAppProperty "AppIcon", dbText, "C:\MyFolder\Calendar.ico"

    Was this answer helpful?

    0 comments No comments