In ACCESS2002, the [start] attribute of the database form can be used to set the title and icon of the application (ACCESS main form). What should I do in ACCESS2000? In fact, ACCESS provides two attributes: AppTitle and AppIco, And the RefreshTitleBar method, which can be used to achieve this purpose. This article will detail how to compile the program
In ACCESS2002, the [start] attribute of the database form can be used to set the title and icon of the application (ACCESS main form). What should I do in ACCESS2000? In fact, ACCESS provides two attributes: AppTitle and AppIco, And the RefreshTitleBar method, which can be used to achieve this purpose. This article will detail how to compile the program
In ACCESS2002, you canPassSet the application in the [start] attribute of the database form.Program(ACCESS main form)TitleAndIconIn ACCESS2000, what should I do? In fact, ACCESS provides AppTitle and AppIco attributes and the RefreshTitleBar method, which can be used to achieve this purpose. This article will introduce in detailHowCompilationProgramAnd use.
First, create a new module and define two constants in the module (routines from Microsoft Help ):
PublicConstDB_TextAsLong = 10' the attribute value is of the text type.
PublicConstDB_BooleanAsLong = 1' the attribute value is of the logical type.
Next, write the following functions (this function comes from the ACCESS help) to add orModifyDatabase attributes.
PublicFunctionAddAppProperty (strNameAsString, varTypeAsVariant, varvalueAsVariant) AsInteger
'================================================ ========================================================== ====================
'The function is used to add attributes to the current database (. mdb ).
'
'Strname: property name
'Vartype: attribute type
'Varvalue: Attribute Value
'
'Return value: Success is True (-1)
'Failure is False (0)
'
'Example: ApplicationProgramTitleBar and ApplicationProgramIcon
'Intx = AddAppProperty ("AppTitle", DB_Text, "Change ApplicationTitleBar and ApplicationProgramIconExample ")
'Intx = AddAppProperty ("AppIcon", DB_Text, CurrentProject. Path & "MSN. ico ")
''Application settings
'Application. RefreshTitleBar
'
'Ease and software: Zhu Yiwen 2002.05.01
'================================================ ========================================================== ====================
DimdbsAsObject, prpAsVariant
Constconpropnotfounderror= 3270
'Returns the Database object variable pointing to the current Database.
Setdbs = currentdb' if it is ADP, it is CurrentProject
OnErrorGoToAddProp_Err
'When changing the property value, an error occurred,
'Indicates that this property does not exist and is redirected to error handling.Program.
Dbs. Properties (strName) = varvalue
AddAppProperty = True
AddProp_Bye:
ExitFunction
AddProp_Err:
IfErr = conPropNotFoundErrorThen
'Add this property
Setgp = dbs. CreateProperty (strName, varType, varvalue)
Dbs. Properties. appendgp
Resume
Else
AddAppProperty = False
ResumeAddProp_Bye
EndIf
EndFunction
Then write and change ACCESSTitleAndIconFunction:
PublicFunctionChangeMyAccessTitle (strTitleAsString) AsInteger
'Set the ACCESS main formTitle
ChangeMyAccessTitle = AddAppProperty ("AppTitle", DB_Text, strTitle)
Application. RefreshTitleBar 'refreshTitleColumn, set the ACCESSTitle
EndFunction
PublicFunctionChangeMyAccessIco (strIcoPathAsString) AsInteger
'Set the ACCESS main formIcon
ChangeMyAccessIco = AddAppProperty ("AppIcon", DB_Text, strIcoPath)
Application. RefreshTitleBar 'refreshTitleColumn, set the ACCESSIcon
EndFunction
If you wantIconIn C: my. ico, you only need:
IX = ChangeMyAccessIco ("C: my. ico ")
If you wantTitleChange to "my application"ProgramAs long:
IX = ChangeMyAccessTitle ("My applicationsProgram")
Author: Unknown