We help IT Professionals succeed at work.

2007 Access Runtime Application Icon

I've tested a dozen VB codes & modules with no success to place my icon in the application tabbed documents-Display Doc Tabs. My icon is a proper .ico file format and is in the same folder as the database.  The desktop and startup icon works fine and the icon shows up in the top and bottom tool bars, it's just the Folder Tab which is missing the icon.

The distributable package works on my XP PC but does not work properly on my test XP Laptop with 2003 Office/Access.

Note: For those that don't know, when you use Access 2007 Runtime it disables the icon feature that you can setup in the Access design environment:

The following features are not included as part of the Access 2007 Runtime without additional customization:

    Navigation Pane

    Title bar text/icon (can be specified by the database instead of by Access)

    Default Office Fluent Ribbon

    Quick Access Toolbar

    Shortcut menus

    Access Help

    Designers (including Filter by Form)

    Visual Basic Editor

Read MS: http://msdn.microsoft.com/en-us/library/cc136539%28office.12%29.aspx



 
See attached database

Open in new window

Icon-Test.accdb
Comment
Watch Question

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
GOLD EXPERT
Top Expert 2007

Commented:
can you upload the  icon ?

mx
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
GOLD EXPERT
Top Expert 2007

Commented:
Never mind ... I have an icon ...
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
GOLD EXPERT
Top Expert 2007

Commented:
Can you post a screen shot of where you are trying to get the icon to show up ?
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
GOLD EXPERT
Top Expert 2007

Commented:
see image
Capture1.gif
Commented:
Thanks for looking at DatabaseMX, I had conflicting code.

I took the on load code out of the form Test and used this code in my splash screen:

Private Sub Form_Load()
DoCmd.ShowToolbar "Ribbon", acToolbarNo

On Error GoTo ErrorHandler
Dim dbs As DAO.Database
Dim obj As Object
Dim strTitle As String
Dim s As String
Dim intX As Integer
Dim strDBIcon As String
Dim strFormIcon As String

    Const DB_Text As Long = 10
    Const conPropNotFoundError = 3270
   
       
' Return Database object variable pointing to
' the current database.
Set dbs = CurrentDb
   
    'Change title bar.
    strTitle = "Icon Test"
    dbs.Properties!AppTitle = strTitle
     
    'Put the icons in the same folder as the Db
       
    'Set the icon for the database
    strDBIcon = "MyPet.ico"
    strFormIcon = "MyPet.ico"
   
    s = Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))) & "\" & strDBIcon
   
    intX = AddAppProperty("AppIcon", DB_Text, s)
   
    ' Update title bar on screen.
    Application.RefreshTitleBar
   
'Set the icon for the form
SetFormIcon Me.hWnd, Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))) & "\" & strFormIcon
'Then set the caption for the form
Me.Caption = "Icon Test"

ErrorHandler:
    If Err.Number = conPropNotFoundError Then
        Set obj = dbs.CreateProperty("Icon Test", dbText, strTitle)
        dbs.Properties.Append obj
    End If
   
    Resume Next
   
End Sub

Function AddAppProperty(strName As String, varType As Variant, varValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270

    Set dbs = CurrentDb
    On Error GoTo AddProp_Err
    dbs.Properties(strName) = varValue
    AddAppProperty = True

AddProp_Bye:
    Exit Function

AddProp_Err:
    If Err = conPropNotFoundError Then
        Set prp = dbs.CreateProperty(strName, varType, varValue)
        dbs.Properties.Append prp
        Resume
    Else
        AddAppProperty = False
        Resume AddProp_Bye
    End If
   
End Function

Private Sub Form_Open(Cancel As Integer)
10      On Error Resume Next

        'hide once VB is enabled by the Access 2007 user
20      Me.lblAccess2007.Visible = False
30      Me.lbl2007Help.Visible = False
         
End Sub



Public Function DBStart()

AddAppProperty "AppTitle", dbText, "Icon Test"
AddAppProperty "AppIcon", dbText, CurrentProject.Path & "\MyPet.ico"
RefreshTitleBar

End Function


Private Sub Form_Timer()
DoCmd.Close acForm, "MyPetSplash"
DoCmd.OpenForm "Test"
End Sub

Author

Commented:
I solved it myself. 8 hrs of testing.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.