0

I'm building an Access database and I'm getting a "User-defined type not defined" error when I compile the project using Debug > Compile, but the database opens and runs without any runtime errors, and everything seems to work. No location in the code is given, just an error dialog.

The UDT error doesn't happen every time, but it does happen most of the time. If I don't have any forms open when I compile and I have recently opened Access it seems to work. If I open a form and try again (after making a superficial change so it will allow me to recompile) I get the error.

This is not true consistently however. I often get the error when no forms are open, but I ALWAYS get the error when forms are open. It doesn't seem to matter if they are open in design or form view.

What could be causing this? What kind of error should I be looking for?

Using Access 2010.

HansUp
  • 95,961
  • 11
  • 77
  • 135
jasongetsdown
  • 1,295
  • 1
  • 17
  • 22
  • Any thing here: http://support.microsoft.com/kb/289664? – Fionnuala Sep 30 '11 at 19:53
  • Nope, I'm not using anything that isn't referenced. I think the DAO 3.6 object library mentioned on that page has been superseded by Microsoft Office 14.0 Access database engine Object Library. When I try to reference it I get an error saying that it conflicts with something I already have referenced. Also, if that were the issue I would expect the compiler error to identify the first offending DAO object it encounters, but it isn't giving me a location in the code. – jasongetsdown Sep 30 '11 at 20:06
  • Bad references can give very confusing errors. – Fionnuala Sep 30 '11 at 20:08
  • MS Office 14 is not for DAO, you will need to reference the DAO Object library if you wish to use DAO recordsets – Fionnuala Sep 30 '11 at 20:10
  • Then why does my project work? I have DAO.Database, DAO.Recorset, and DAO.Error objects in a dozen different procedures. The references I have are Visual Basic for Applications, Microsoft Access 14.0 Object Library, OLE Automation, and Microsoft Office 14.0 Access database engine Object Library. If I try to reference Microsoft DAO 3.6 Object Library as well I get the error "Name conflicts with existing module, project, or object library" – jasongetsdown Sep 30 '11 at 20:27
  • Sorry, I did not read that quite right, Microsoft Office 14.0 Access database engine Object Library should be fine. – Fionnuala Sep 30 '11 at 20:41
  • Repairing Access probably wouldn't hurt, either. – Fionnuala Sep 30 '11 at 22:32
  • 1
    Tony Toews MS-A MVP has a whole page on decompile: http://www.granite.ab.ca/access/decompile.htm – Fionnuala Sep 30 '11 at 22:34

1 Answers1

1

Thanks HansUp, a decompile seems to have resolved the issue. The instructions you linked were helpful.

Community
  • 1
  • 1
jasongetsdown
  • 1,295
  • 1
  • 17
  • 22
  • Decompiling is something you should do semi-regularly, along with all the other things I recommended. If you take care of your code, you won't have these kinds of weird compilation errors in the first place. – David-W-Fenton Oct 06 '11 at 19:22