AppIcon Property

Applies To

Database Object.

Description

You can use the AppIcon property to specify the name of the bitmap (.bmp) or icon (.ico) file that contains the application’s icon. For example, you can use the AppIcon property to specify a .bmp file that contains an picture of an automobile to represent an automotive parts application.

Setting

The AppIcon property is a string expression that is a bitmap or icon filename.

You can set this property by using a macro or Visual Basic. You can also set this property using the Application Icon option in the Startup dialog box, available by clicking Startup on the Tools menu. This is the easiest way to set this property.

To set the AppIcon property using Visual Basic you must first create the property using the CreateProperty method and append it to the Database properties collection.

Remarks

This property setting takes effect immediately after it is set in code or the Startup dialog box is closed.

If you are distributing your application, it is recommended that the .bmp or .ico file containing the icon reside in the same directory as your Microsoft Access application.

If the AppIcon property is not set or is invalid, the Microsoft Access icon is displayed.

See Also

AppTitle Property.

Example

The following example shows how to change the AppIcon and AppTitle properties. If the properties have not already been set or created, you must create them and append them to the Database object using the CreateProperty method.


Sub cmdAddProp_Click()
    Dim x As Integer
    x = AddAppProperty("AppTitle", dbText, "My Custom Application")
    x = AddAppProperty("AppIcon", dbText, "C:\Windows\Cars.bmp")Sub
AddAppProperty(prpName As String, prpType As Variant, _ 
        prpValue As Variant) As Integer
    Dim dbs As Database, prp As Property
    Const conPropNotFoundError = 3270
    Set dbs = CurrentDb
    On Error GoTo AddProp_Err
    dbs.Properties(prpName) = prpValue
    AddAppProperty = True_Bye:
    Exit Function_Err:
    If Err = conPropNotFoundError Then
        Set prp = dbs.CreateProperty(prpName, prpType, prpValue)
        dbs.Properties.Append prp
        Resume
    Else
        AddAppProperty = False
        Resume AddProp_Bye
    End IfFunction