2009-03-30 8 views

Antwort

1

Es ist eine benutzerdefinierte Eigenschaft ("AppIcon") des Datenbankobjekts.

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

Hinweis - Sie erhalten einen Fehler, wenn die Eigenschaft nicht existiert.

Dieser Code aus der Access-Hilfe zeigt, wie die Eigenschaft erstellen:

Beispiel

Das folgende Beispiel zeigt, wie die AppIcon und AppTitle Eigenschaften in einer Microsoft Access-Datenbank ändern (.mdb). Wenn die Eigenschaften nicht bereits festgelegt oder erstellt wurden, müssen Sie sie erstellen und mit der CreateProperty-Methode an die Properties-Auflistung anhängen.

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