Type mismatch error when setting DAO property - references anddisambiguation okay

O

otterbyte

I have an Access 2003 database and I have the code to disable the
bypass key on startup set. I just moved to a new computer (and from
Win XP to Vista Business) and now the code breaks with Type Mismatch
on the "Set prp..." line:

*******************
Dim strDB As String
Dim db As DAO.Database
Dim prp As DAO.Property

strDB = InputBox("Enter Path for mde or mdb:", "Prep for
Distribution", _
"C:\MyDatabase.mde")
Set db = DBEngine.Workspaces(0).OpenDatabase(strDB)

With db .Properties.Delete "AllowByPassKey"
Set prp = .CreateProperty("AllowByPassKey", dbBoolean, False,
True)
.Properties.Append prp
End With
*********************

I've checked my references. Nothing is missing, I don't have ADO
checked, and the DAO reference is as high as it can go (just below the
VBA and Access 9.0 references, and above the OLE automation and VBA
extensibility references). I've properly (I think) disambiguated the
creation of the Property object, prp. The code compiles.

So am I missing something really obvious? I can't figure this one
out!
 
O

otterbyte

Well, double dope slaps to me. :) I forgot that this database is the
one that's still in Access 2003, and I forgot that the mde file also
has a security setup on it that I hadn't disabled yet on the new
computer, so of course the code couldn't access it. Why it came out as
Type Mismatch, I don't know, but it's fixed now.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top