In ACCESS2000, how does one Modify the title and icon of the ACCESS main form through a program?

Source: Internet
Author: User
Tags microsoft help
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.