• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1377
  • Last Modified:

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.
0
GanaSonaDa
Asked:
GanaSonaDa
4 Solutions
 
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  

Debug>compile

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

good luck...
0
 
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
0
 
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?
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
jjafferrCommented:
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,

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


Hi Rey, long time no see :o)

jaffer
0
 
Benjamin_LukCommented:
You should transfer the old DB to new version, and then do the compile.

Best Regards

Ben
0
 
Alan WarrenCommented:
GanaSonaDa

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)
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now