By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,191 Members | 1,064 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,191 IT Pros & Developers. It's quick & easy.

Startup Application Icon (Front End)

P: n/a
Hello

I would like to use a custom icon at startup.
Currently, I have defined the icon in the Access Startup option.
This works fine, however, it requires the icon to be located with the
BackEnd File. How can I require it to be with the FrontEnd File and
be assured that my app will look for it wherever the FE may be located
or started from.

Thanks
Greg

Mar 19 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a

The 97 help states to put it with the 'application'.

"If you'll be distributing your application, it's recommended that the
icon file reside in the same folder as your Microsoft Access
application."

I assume that to mean the front-end.

Mar 19 '07 #2

P: n/a

Hi Mike

I would have thought the same, however my test showed otherwise.
If I set the FE app up in folder ABC and test, it works fine.
If I move the FE app to folder XYZ the path to the icon in Access
Startup does not change. Hence, it looks in the old folder. No good
since this app will be distributed.

There must be a way to link the icon to the FE path or something using
code?

Greg

Mar 19 '07 #3

P: n/a

There are a number of ways.
Easiest might be CurDir(). This should give the current path (which
should be the path to the file that called it) without the db's file
name in it. Append the icon filename to it and use the new path
string.
Next easiest is probably the registry. The SaveSetting() and
GetSetting() functions let you add and retrieve entries from a
particular place in the registry. You could write the icon path here
and retrieve it when needed, but the trick is getting it in there to
begin with. I use an installation program, so the keys are generated
when the app is installed using installed paths.

Regardless of how you store and retrieve it, you can apply the new
path in code using the CreateProperty method of a DB object (usually
CurrentDB). The help file explains how and should even have a code
example requiring little modification.

The icon change won't be apllied until the next time the DB starts.

Mar 19 '07 #4

P: n/a
Thanks Mike

I found the following code that had honorable mention to Ken Getz and
Dev Ashish.
I tested it and it works as I need. I will check out your advice, but
I run scared on registry stuff. Give me time!

Thanks As Always
Greg

Private Sub Form_Load()
Dim strIcon As String
Dim intX As Integer
strIcon = CurrentDBDir()
intX = AddAppProperty("AppIcon", dbText, strIcon & "md.ico")
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

Mar 19 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.