Refreshing icon path?

T

Tony_VBACoder

Here is the code that I use in my ApplicationInitialize
routine:

' Set the icon for the application. If the file is not
found, Access will default to nothing
SetStartupOptions "AppIcon", 10, sCurrentDBPath
& "Files\check.ico"


Public Sub SetStartupOptions(sPropertyName As String, _
vPropertyType As Variant,
sPropertyValue As String)
Dim dbs As Object
Dim prp As Object

Set dbs = Application.CurrentDb
On Error Resume Next

' Check to make sure this doesn't already exist
If dbs.Properties(sPropertyName) = sPropertyValue Then
' This already exists - do nothing
Set dbs = Nothing
Exit Sub
End If

dbs.Properties(sPropertyName) = sPropertyValue

Set prp = dbs.CreateProperty(sPropertyName, vPropertyType,
sPropertyValue)
dbs.Properties.Append prp
Application.RefreshTitleBar

Set dbs = Nothing
Set prp = Nothing

End Sub

-----Original Message-----
Hi,
I'm updating the program Icon with this property
CurrentDb.Containers!Databases.Documents!MSysDb.Properties ("AppIcon")
However, the changes don't appear right away, even when I
run the code with a AutoExec macro. I have to close the db
and reopen it for the icon to show up.
 
M

Marshall Barton

This looks like a followup question to Audry's thread. Are
you both taking the same Access class? ;-)

Since you never said if there was a problem or whatever made
you post the code, I'll guess that the issue is that
something doesn't work and you don't see what's wrong. I
think the failure is obscured by your use of On Error Resume
Next. I'm pretty sure that the If statement is failing when
the property doesn't yet exist and the If is inadequete in
detecting this situation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top