Compile Error

I open up an access database and before allowing to do anything it straight away reads:

compile error:
sub or function not defined.

where can you go to place the tick out of the box for this to go away and for the database to open up in peace, i think that's what the problem may be but am looking for help.
Who is Participating?
Rey Obrero (Capricorn1)Commented:
if the forms design view are not enabled ..
then, the db you are using is in mde format and cannot be modified.

you have to use the mdb version if it is available if it is not then you cannot do anything with the problem
Rey Obrero (Capricorn1)Commented:
try holding the shift key while opening the db.

see if the db will open and show the db object window.

click a form and click design.

then View>Code

in the vba window  


take not of the error that will show and post it here or try to correct.

good luck...
GanaSonaDaAuthor Commented:
Sorry that was for an older database, my error is: compile error:
can't find project or library.
I have made myself an administrator of this app and it says when i click o.k. that i do not have access when selecting design mode.
this is bizzare as last time i removed some ticks where missing and the like are. need to know how to a) get back there and check b) what ticks are in place or should be in place if not any of them should be removed?
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Hi GanaSonaDa

I think some of your References are MISSING
go to code (VBA) then menu bar > tools > references and uncheck all those checkboxes which say MISSING,

make a new mdb, then import everything from the old mdb.

Hi Rey, long time no see :o)

You should transfer the old DB to new version, and then do the compile.

Best Regards

Alan WarrenApplications DeveloperCommented:

You should be able to create a New Module, Module1
Then on the Debug Menu > Compile 'Your.mdb'

This will invoke the VBA compiler, which should Highlight the offending line/lines of code.

The 'sub or function not defined' error is usually raised when the sub or function being invoked  is  outside the scope of current procedure, you may be able to fix this by locating the sub or function and importing it into the current form code library. Alternatively if you need to reference this sub or or function from multiple  forms you can make the sub or function global by moving it to a New Module.

The  other thing to check for is the Form's 'hasModule' property.

Alan ":0)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.