Icons and InstallShield - Can Anyone Help? (1 Viewer)

StrumBudDo

New member
Local time
Today, 05:50
Joined
Jan 22, 2003
Messages
7
I have built an Access application, and using the Tools - Startup and setting the Icon field to a path and file on my computer works no problem, and the icon I specify replaces the standard Access icon.

However, my company is about to start selling this application, and we are using InstallShield Express to build our installation routine. There are many icon related things you can define in InstallShield, and I can get all of my shortcuts (desktop, Start - Programs menu, etc.) to my Access file to have the desired, non-Access icon no problem. However, since the Tools - Startup - Icon within Access is an internal Access attribute, I cannot figure out a way to specify in a general way where the icon file was installed (because the user may specify his own path for where to install the App and the icon). I.e., I can specify an absolute path (like c:\icon.ico) within Access, but I can not know for certain whether the person installing it even has a C: (they may be doing a network install, etc.).

Is there a way to specify a non-absolute path within Access for that Icon path, since the icon file will be copied to the same directory as the App? Example - installer specifies C:\Program Files\My App, and both MyApp.mde and MyIcon.ico are installed there. However, if I had packaged up MyApp.mde with a path of just MyIcon.ico, it doesn't automatically look in the same directory at the App, but rather gives an error that it cannot find the icon.

Any ideas on this at all would be super duper appreciated!!!

Thanks in advance,

Scott
 

ghudson

Registered User.
Local time
Today, 00:50
Joined
Jun 8, 2002
Messages
6,195
This will tell you where the db is located...

Left(CurrentDb.Name,Len(CurrentDb.Name)-Len(Dir(CurrentDb.Name)))

Since the icon will be in the same folder as the db, that should allow you to set the startup property with code.

SetProperties "AppIcon", dbText, Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))) & "icon.ico"

Check the help files for the AppIcon Property for more info and examples.

HTH
 

StrumBudDo

New member
Local time
Today, 05:50
Joined
Jan 22, 2003
Messages
7
Almost works??

I tried the code you suggested and I get a "Sub or Function not defined" error, and the debugger highlights the SetProperties part of that line of code. (I tested the part of the code that gives the path of the icon, and it works beautifully).


Code:
SetProperties "AppIcon", dbText, Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))) & "icon.ico"

I looked in the AppIcon Properties help and it says:

"To set the AppIcon property by using a macro or Visual Basic, you must first either set the property in the Startup dialog box once or create the property in the following ways:

In a Microsoft Access database (.mdb), you can add it by using the CreateProperty method and append it to the Properties collection of the Database object. "

However, I did set the property in the Startup dialog box (and I get the same error), and I can find no help on the CreateProperty method.


Any idea on how to do this or what else I might be doing wrong?


Thanks again,


Scott
 

StrumBudDo

New member
Local time
Today, 05:50
Joined
Jan 22, 2003
Messages
7
Getting there?

I found a section in the help about setting and/or appending properties, but I can't get it to work.


Dim dbs As DAO.Database
Set dbs = CurrentDb

dbs.Properties.Append (AppIcon)


gives an "Object Required" error. AppIcon in quotes gives Type Mismatch.

I think I'm really close. Anyone know what I'm doing wrong?


Thanks,

Scott
 

StrumBudDo

New member
Local time
Today, 05:50
Joined
Jan 22, 2003
Messages
7
Got it working - Thank you ghudson!!

Essentially I just had to figure out how to properly set a property in my code. Thanks a million for the idea and sample code, ghudson!


Here's the final code I'm using:

Dim dbs As DAO.Database
Set dbs = CurrentDb

dbs.Properties("AppIcon") = Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))) & "icon.ico"
 

chewy

SuperNintendo Chalmers
Local time
Today, 05:50
Joined
Mar 8, 2002
Messages
581
where did you put that code?
 

StrumBudDo

New member
Local time
Today, 05:50
Joined
Jan 22, 2003
Messages
7
Where I put it

I already had a form that never gets seen by anyone that is the form that opens on startup - the event procedure for the form checks to see if the product has been registered and either brings up the registration form or brings up the main menu, again, fast enough to never be seen. Now the form also assigns the AppIcon property to the desired path and file.


Scott
 

Users who are viewing this thread

Top Bottom