Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi all, I am using Access 2000

Status
Not open for further replies.

idd

Programmer
Apr 19, 2002
165
GB
Hi all,

I am using Access 2000

I found some code which should allow my app to set the app icon when it loads up, assuming that it is in the same folder as the database. The reason for wanting to do this is so that when I distribute the db to other departments their path to the db and the icon file will not be the same as mine. SO I need it do it wherever a user keeps it as long as the icon file is in the same directory as the db.

unfortunately when I tried running the code it did not work becauseoff an error access 2000 threw up. It is possible that the code was written for Access 97, as the thread was back in 2001 about May time I think.

I was going to reference the thread here but my computer crashed and I cant seem to find the thread now.


the bit which causes the problem is

the code which reads


Set prp = dbs.CreateProperty(strPropName, _
PropType, varPropValue

in the function changeproperty

the problem it gives is type mismatch, i'm not knowledgeable enough to find out whats wrong can someone help ??

Idd

here is the code

--------------------------
start of code
-------------------------------------


Function SetStartupProperties()
'Set icon what location is same DB location's
ChangeProperty "AppIcon", dbText, DirOfFile & "staff lookup.ico"

End Function


'--------------------------------------------
'next function
'--------------------------------------------


Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Database, prp As Property
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True

Change_Bye:
Exit Function

Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
PropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function


'--------------------------------------------
'next function
'--------------------------------------------



Function DirOfFile(Optional strPath As String = "", Optional blnMasterDir As Boolean = False) As String
'Directory of file
DirOfFile = strPath
Dim i As Byte

If strPath = "" Then strPath = CurrentDb.Name

For i = 1 To Len(strPath)
If Mid(strPath, i, 1) = "\" Then
DirOfFile = Left(strPath, i)
If blnMasterDir = True Then
If i > 1 Then
If Mid(strPath, i - 1, 1) <> &quot;:&quot; Then
Exit For
End If
End If
End If
End If
Next i
End Function


 
Please Ignore this thread as I forgot to put the subject, hence the un-infomative subject line.

Is there a way of getting a wasted thread deleted ?

the new thread in which I posted the question with a proper subject is given below.

thread181-580934

Idd
 
Hi this is one way to do it, this will make the Windows Help Icon the App Icon:

Dim dbs As DAO.Database, prpIcon As DAO.Property, strIcon As String
Dim strIcon As String
On Error GoTo ErrAppIcon
Set dbs = CurrentDb
Set prpIcon = dbs.CreateProperty(&quot;AppIcon&quot;, dbText, &quot;C:\windows\help.ico&quot;)
dbs.Properties.Append prpIcon
Application.RefreshTitleBar
dbs.Close
Exit Sub
ErrAppIcon:
MsgBox err.Number & &quot; ; &quot; & err.Description

Bill

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top