Add icon in ADP programmatically

J

Jose Perdigao

How can i add a icon programmaticallyin a file ADP?

In mdb, I use the following code:
Dim DB ADAO.Database
Set DB=CurrentDB
DB.Properties("AppIcon") = CurrentProject.path & "\Update.ico"

If I use this code in ADP doesn't work

Any Suggestions?

Thanks
Jose
 
J

Jose Perdigao

Hi Sylvain,
The example on the site is for mdb and for mdb I know to do.
Do you have an example to ADP?
Thanks
 
R

Robert Morley

If you look closely in the article, it DOES give you a lead on how to do it
in an ADP, though they don't give you a specific example.

While I haven't tried this myself, based on what it says on the page, I
believe you could simply use:

CurrentProject.AccessObjectProperties.Add("AppIcon")
CurrentProject.AccessObjectProperties("AppIcon") = CurrentProject.path &
"\Update.ico"

Give it a try and let us know. I don't use AccessObjectProperties for very
much, so I might have done something wrong in the above code, but it should
be close, at any rate.



Rob
 
J

Jose Perdigao

Hi Robert

I tried your code before and don’t work.

Fortunately I found an example and works good, very good.

Here you are:

Function Startup()

Dim cnn As CurrentProject
Dim prp As ADODB.Property
On Error GoTo ErrorHandler

Set cnn = Application.CurrentProject
'Try to set the property, if it fails, the property does not exist.

cnn.Properties("CopyRightNotice") = "© Your App"
cnn.Properties("AppTitle") = "Your App Name"
cnn.Properties("AppIcon") = "C:\BLK2DB\AllocSystSQL\Files\Update.ico"
cnn.Properties("StartUpShowDBWindow") = False
cnn.Properties("AllowSpecialKeys") = False
cnn.Properties("AllowBuiltInToolbars") = False
cnn.Properties("AllowFullMenus") = False
cnn.Properties("AllowShortcutMenus") = False
cnn.Properties("AllowToolbarChanges") = False
Application.RefreshTitleBar

ExitLine:
Set cnn = Nothing
Set prp = Nothing
Exit Function
ErrorHandler:
If Err = 2455 Then ' Create the new property.
cnn.Properties.Add "CopyRightNotice", "© Your App"
Resume Next
Else
Resume ExitLine
End If
End Function

Regards
 
E

e;o

Robert Morley said:
If you look closely in the article, it DOES give you a lead on how to do
it in an ADP, though they don't give you a specific example.

While I haven't tried this myself, based on what it says on the page, I
believe you could simply use:

CurrentProject.AccessObjectProperties.Add("AppIcon")
CurrentProject.AccessObjectProperties("AppIcon") = CurrentProject.path
& "\Update.ico"

Give it a try and let us know. I don't use AccessObjectProperties for
very much, so I might have done something wrong in the above code, but it
should be close, at any rate.



Rob
 

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