The Property object exists in many different object models. Since you're
using DAO, it's essential that you get a DAO Property.
Replace
Dim prp As Property
with
Dim prp As DAO.Property
There would be nothing wrong with using Dim DB As DAO.Database, but since
(at present) no other object model than DAO has a Database object in it, you
can probably get away without the specification (FWIW, I always use
DAO.Database)

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Function DisableByPassKeyProperty()
> Dim DB As Database
[quoted text clipped - 3 lines]
> Set prp = DB.CreateProperty("AllowByPassKey", dbBoolean, False)
> DB.Properties.Append prp