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

Compile Error: Can't Assign To Read-Only Property

P: n/a
The following which is driving me nuts has occurred in 2 of my
databases. Both databases were written in Access 2003 and then
converted back to Access 2000 format. I've done this so I can create an
Access 2K mde for compatibility reasons.

Everything worked fine: the database could be compiled and converted to
an .mde several times. Then for no apparent reason when I tried to
compile again I got the following error: "Compile Error: Can't assign
to read only property" for the ".name" property in the following code.

Dim strAppPath As String
Dim prpAppIcon As Property
Dim db As Database
On Error Resume Next

strAppPath = mydbPath() & "Fire.ico" 'set icon path
Set db = CurrentDb
Set prpAppIcon = db.CreateProperty()
prpAppIcon.Name = "AppIcon"
prpAppIcon.Type = dbText
prpAppIcon.Value = strAppPath
db.Properties.Append prpAppIcon
db.Properties("AppIcon") = strAppPath
Application.RefreshTitleBar

Set db = Nothing

Exit Function

End Function

Why will it compile a dozen times and the next time give the error? I'm
assuming from the error message that the property was not read only and
then something made it read only.

Any help would be appreciated.

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Not a direct answer, but, perhaps if you put the CreateProperty()
parameters in the parentheses it would work more consistently.

db.Properties.Append db.CreateProperty("AppIcon", dbText, strAppPath)

IOW, you wouldn't be assigning a value to the .Name parameter in a
different VBA command.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQd1x0oechKqOuFEgEQIvcwCfSHSPEQLTaksSkdBpvBscYL aAUu8AoON2
wUAaNkHnIf6Uu9Logrp+Re07
=SDqE
-----END PGP SIGNATURE-----
Wayne wrote:
The following which is driving me nuts has occurred in 2 of my
databases. Both databases were written in Access 2003 and then
converted back to Access 2000 format. I've done this so I can create an
Access 2K mde for compatibility reasons.

Everything worked fine: the database could be compiled and converted to
an .mde several times. Then for no apparent reason when I tried to
compile again I got the following error: "Compile Error: Can't assign
to read only property" for the ".name" property in the following code.

Dim strAppPath As String
Dim prpAppIcon As Property
Dim db As Database
On Error Resume Next

strAppPath = mydbPath() & "Fire.ico" 'set icon path
Set db = CurrentDb
Set prpAppIcon = db.CreateProperty()
prpAppIcon.Name = "AppIcon"
prpAppIcon.Type = dbText
prpAppIcon.Value = strAppPath
db.Properties.Append prpAppIcon
db.Properties("AppIcon") = strAppPath
Application.RefreshTitleBar

Set db = Nothing

Exit Function

End Function

Why will it compile a dozen times and the next time give the error? I'm
assuming from the error message that the property was not read only and
then something made it read only.

Nov 13 '05 #2

P: n/a
Thanks for the reply. I've changed the code as you have suggested.
No, I'm not assigning the .Name parameter anywhere else. I've used
this code which I found here on the group many times before to set the
application icon without this problem ever arising. I can't help but
be suspicious that it has something to do with the fact that the
database was created in version 2003 file format and then converted
back to version 2000 file format. In both databases that have given me
a problem, the problem seemed to arise after the conversion. I'm not
sure what the ramifications of the backward conversion are but all the
other databases in which I have used this code that have never given a
problem were created in 2000 file format using Access 2003.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.