MS Access中的应用程序图标路径 [英] Application Icon path in MS Access

查看:320
本文介绍了MS Access中的应用程序图标路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以编程方式访问MS Access 2003中的应用程序图标路径?

How do you access the Application Icon path in MS Access 2003 programmatically?

推荐答案

这是一个自定义属性(AppIcon数据库对象。

It's a custom property ("AppIcon") of the database object.

Set dbs = CurrentDb
sAppIconPath = dbs.Properties("AppIcon")

注意 - 如果物业不存在,您将收到错误。

Note - you will get an error if the property doesn;t exist.

访问帮助中的此代码显示了如何创建属性:

This code from the Access Help shows how to create the property:

示例

以下示例说明如何更改Microsoft Access数据库(.mdb)中的AppIcon和AppTitle属性。如果尚未设置或创建属性,则必须使用CreateProperty方法创建它们并将它们附加到Properties集合。

The following example shows how to change the AppIcon and AppTitle properties in a Microsoft Access database (.mdb). If the properties haven't already been set or created, you must create them and append them to the Properties collection by using the CreateProperty method.

Sub cmdAddProp_Click()
    Dim intX As Integer
    Const DB_Text As Long = 10
    intX = AddAppProperty("AppTitle", DB_Text, "My Custom Application")
    intX = AddAppProperty("AppIcon", DB_Text, "C:\Windows\Cars.bmp")
    CurrentDb.Properties("UseAppIconForFrmRpt") = 1
    Application.RefreshTitleBar
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

这篇关于MS Access中的应用程序图标路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆