How do I programmatically change the Application Icon in an Access 2000 database with my own custom built icon.
I am aware that you can change it by using built in access startup option. Tools>>> StartUP>>>Application icon.
intX = AddAppProperty("AppTitle", dbText, "My Custom Application"
intX = AddAppProperty("AppIcon", dbText, "C:\Windows\Cars.bmp"
RefreshTitleBar
End Sub
Function AddAppProperty(strName As String, varType As Variant, varValue As Variant) As Integer
Dim dbs As Database, prp As Property
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
You could also try this in the On Load event of the Form that Loads at Startup. Replacing C:\windows\help.ico with the path and name of your own icon. Edit or remove the Error Handling to best suit your purposes:
Dim dbs As Database
Dim prpIcon As Property
Dim strIcon As String
On Error GoTo ErrAppIcon
Set dbs = CurrentDb
Set prpIcon = dbs.CreateProperty("AppIcon", dbText, "C:\windows\help.ico"
dbs.Properties.Append prpIcon
Application.RefreshTitleBar
dbs.Close
Exit Sub
ErrAppIcon:
MsgBox err.Number & " ; " & err.Description
That's a good idea, but where to put my example code was just a suggestion as was yours. Eddie didn't say when or where he wanted to set the icon or how often.
I would just like to ask how to use your codes. I tried applying them as a module (beetee's code) and as an onload event (billpower's code). But I didn't get results for either one. I know I did something wrong in applying your codes. Can you guys give me an explanation? Thanks!
When I use the startup options to specify a custom icon for the database and I deselect the display database window checkbox, the database window is still displayed when I launch the database. Do your codes have the same effect guys? Please reply soon. Thanks again!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.