MS Access 2003 Database not running under MS Access 2010

I rely on a custom Access Database that runs fine under Access 2003.  I am trying to run it under MS Access 2010 but receive the following error message:

Microsoft Visual Basic for Applications: Compile Error: Cannot find project or library

The debugger shows an error highlighting the word "Date" in  Me!SelectDate = Date  'Now()

Here is the full context of that error:

    Private Sub Form_Load()
    '  Enter parameters in BeginningDate and EndingDate text boxes when
    '  form is loaded.
    Me!BeginningDate = DateSerial(Format(Date, "yy"), Format(Date, "m") - 6, 1)
    Me!EndingDate = Date

I had to copy some ocx files into the Windows\System32 directory and the Program Files (x86)\Office\Microsoft Office\Office14 directory to get the calendar and other custom forms to work, but they do not seem to be the issue here.

Any thoughts on where to begin fixing this?

Who is Participating?
Nick67Connect With a Mentor Commented:
You HAVE to unmark 'missing' references
The problem is clearly one of references.

In any open module choose Tools>References.
Make sure that all the objects/libraries you need are selected and that none is marked as missing.
If any is marked as missing then deselect it and select the correct option from the drop down list below.

Close the References doialog and check things are OK using Debug>Compile.
QualitycomputerAuthor Commented:
I have the form open that displayed the error that I posted and I select "tools - references".  Unfortunately, "references" is greyed out.
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

You have to keep hitting the 'stop' block on the VBA editor until the code finally stops trying to run and the yellowed line stops being colored.  You may get a message about 'Halt' autoexec.
Then you can get into the references to find the missing one.
Alternatively, opening the db while holding the shift button may open it without any code running.
Then open the editor and try Tools | References
I had a similar problem recently, this link might explain for you: ID 26981743
QualitycomputerAuthor Commented:
Nick67:  I don't know how to get to the "tool - references" menu if the code is not running.  I have all of my forms listed on the pane on the left side with nothing open in the main window.  Is it possible to check the references from this view? Even with out any forms active or code running the "references' menu is greyed out.  

Andymacf:  That article looks like it might have the fix.  Here is a quote from the article:

"It [ADO] appears in the reference list as 'Microsoft ActiveX Data Objects x.x Library'.  Unless it is required, it should be un-ticked to remove it from the reference list."

Sorry to be so clueless but I don't know how to navigate to that area of the Access 2010.
Choose Create>VisualBasic from the ribbon to get to the VBA screen.
The debugger menu has Tools and then References
 VBA windowThe square block 'stop' button is just underneath tools

Do you have a 'developer' tab?
That's where you get into the Visual Basic editor, if you don't have a debug error on the go.
If you have no 'developer' tab, you need to turn it on in BackStage options I think
QualitycomputerAuthor Commented:
I was finally able to stop the code (from the Visual Basic menu) and then the Tools- References was no longer greyed out.  Running "references" I now see that one of the checked boxes is labelled "MISSING: Microsoft Common Dialog Control 6.0".  I unchecked that and then instead of the debugger running it only said that a control was missing.  I restored the file so I am back to where I was.  

What do you think I should do next?  Should I try to install the missing dialog control, and if so, how do I do that?  From the article Experts Exchange article ID 26981743 it seems that it may be possible to use more up-to-date controls (ADE).  Is that possible without the old code that I am running?  The database was originally written from Access 2000.
QualitycomputerAuthor Commented:
I tried browsing to the Program Files subdirectory that contains a copy of comdlg32.ocx to relink that Active X control but I receive an error "can't add a reference to the specified file".
Wrong file I think
Here's where the common controls are on my machine.
Do a search for the file, not the path.
You may need to register it.
conmmon controls
QualitycomputerAuthor Commented:
I registered MSCOMCTL.OCX from the SysWOW64 directory successfully and moved it higher than the control that is marked "MISSING".  Still, no luck -- the same error is happening.  Visual Basic doesn't recognize the "DATE" reference.
QualitycomputerAuthor Commented:
That did the trick!
QualitycomputerAuthor Commented:
I spoke to soon.  I was able to get farther but a different report is now giving me the missing reference error:

  Me!SelectDate = Date  'Now()

Should I open a new question since I already awarded points?  Sorry to be inept when it comes to such things.
Missing references are an application level problem, it's just that they manifest themselcves as run-time execution problems.
The location of the problem (in the code) is irrelevent to the problem.  The error could occur anywhere.
The fixing has to be done in the References dialog.

As well as missing references there can be problem if the selected file is a different version to the one installed on the run-time machine.
In such cases, it is necessary to deselect everything that can be de-selected,  close and re-open the references dialog and then re-select all the required  libraries.
QualitycomputerAuthor Commented:
Peter57r:  I tried your suggestion but still no luck.  Should I open a related question so that I can award more points?  The last fix seems to have everything but the calendar control working properly.  I understood your previous comment about it being an application-level problem, yet it would seem that if I can provide a control that will allow my database to call the calendar everything should be fine.
Ah, the calendar control!
That has been deprecated in Access 2010
You can get it going again, but it does take some doing.
The file is MSCAL.OCX
You have to find it on an older system.
It HAS to be registered.
I have a VBScript that I built to do it as I acquire more Access 2010 systems
The guts of it are to copy MSCAL.OCX to C:\Program Files (x86)\microsoft office\OFFICE14
and then register it.  After you copy it to the noted location, at a command prompt enter:

C:\windows\system32\RegSvr32 /s C:\Program Files (x86)\microsoft office\OFFICE14\mscal.ocx
QualitycomputerAuthor Commented:
I think that the control is now registered but it still doesn't work.  I opened another question so that I can award more points.  You have all been incredibly helpful!
You have to make it a reference too!
Open Tools | References | Browse and go find it and add it as a reference
It takes a little fiddle-farting of opening the form in Design view sometimes.
I think too, I may have copied the registry keys from a unit I got working to the other ones I deployed.
Keep plugging away at it while I look
There they are!
One set of keys
Windows Registry Editor Version 5.00


@="Microsoft Calendar Control 11.0"


@="C:\\Program Files (x86)\\Microsoft Office\\Office14\\MSCAL.OCX"


@="C:\\Program Files (x86)\\Microsoft Office\\Office14"

Open in new window

And the other
Windows Registry Editor Version 5.00

@="Calendar Control 11.0"


[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{8E27C92B-1264-101C-8A2F-040224009C02}\Implemented Categories]

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{8E27C92B-1264-101C-8A2F-040224009C02}\Implemented Categories\{40FC6ED4-2438-11CF-A3DB-080036F12502}]

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{8E27C92B-1264-101C-8A2F-040224009C02}\Implemented Categories\{40FC6ED5-2438-11CF-A3DB-080036F12502}]

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{8E27C92B-1264-101C-8A2F-040224009C02}\Implemented Categories\{7DD95801-9882-11CF-9FA9-00AA006C42C4}]

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{8E27C92B-1264-101C-8A2F-040224009C02}\Implemented Categories\{7DD95802-9882-11CF-9FA9-00AA006C42C4}]

@="C:\\Program Files (x86)\\Microsoft Office\\Office14\\MSCAL.OCX"






@="C:\\Program Files (x86)\\Microsoft Office\\Office14\\MSCAL.OCX, 1"




Open in new window

Copy each snippet into notepad and name them something like MSCAL.reg
Merge them in and try it!
QualitycomputerAuthor Commented:

Thanks so very much.  I have a couple of remaining questions about your last posts (i.e. adding the reference and creating the .reg files).  Would you prefer to repost your last two suggestions on the new topic thread so that I can assign you some more points?
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.