?
Solved

Error on Compile - Cant find project or library

Posted on 2014-11-03
9
Medium Priority
?
213 Views
Last Modified: 2014-11-03
Experts, why would I get a compile error on the word "Date" below?   It is in a 2007 db and I dont think I had an error in that db when I was using it a few years back.  I am using 2010 now and when I compile I get that error.

error:  "Cant find project or library"

thank you

here is the code:
Private Sub cmdyear_Click()
'Sets the Date From and Date To text boxes
'to show complete current year

    Me.txtdatefrom = Date              'problem appears to be on this line with the "Date" function
    Me.txtDateTo = DateAdd("yyyy", 1, Date)
    
End Sub

Open in new window

0
Comment
Question by:pdvsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
9 Comments
 
LVL 28

Expert Comment

by:omgang
ID: 40419651
I don't get a compile error in 2010 mdb format.

Doesn't like the code snipet below
 
 Me.txtdatefrom = [b][u]Date[/u][/b] 

Open in new window

Syntax error.

Do you want to display the text in the form control as bold and underlined?  You'll need to set the control properties to do so.

OM Gang
0
 
LVL 46

Expert Comment

by:aikimark
ID: 40419664
Please try this.
Private Sub cmdyear_Click()
'Sets the Date From and Date To text boxes
'to show complete current year

    Me.txtdatefrom.Value = Date()              'problem appears to be on this line with the "Date" function
    Me.txtDateTo.Value = DateAdd("yyyy", 1, Date() )
    
End Sub

Open in new window

0
 
LVL 28

Accepted Solution

by:
omgang earned 1000 total points
ID: 40419672
Test by creating a new, blank, mdb in your Access 2010.  Create a test form (Form1), add the controls txtDateFrom & txtDateTo as well as cmdYear.  Add your cmdYear_Click sub procedure.  Do you still receive the error about missing library?
OM Gang
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 5

Expert Comment

by:ReneD100
ID: 40419739
Look in the VBA editor at Tools/References. There is probably a missing reference that is causing the error.
0
 

Author Comment

by:pdvsa
ID: 40419943
aikimark:
I added .value and the open and closed parent but still have the error.  fyi: the open and closed parenth were actually removed automatically by Access.

OMgang:
I made a new db in 2010 and made a form with the controls and code and the error is no longer there on compile.  
Do you know why?  I mean I dont understand why I would get the error in a 2007 db.  

Rene:
<Look in the VBA editor at Tools/References. There is probably a missing reference that is causing the error.
The only missing refs are dealing with Lotus Notes


see the missing refs: (only LN)
Missing Refs
0
 
LVL 5

Assisted Solution

by:ReneD100
ReneD100 earned 1000 total points
ID: 40419954
Remove the missing ones and your error is fixed (uncheck). You may want to check why you needed those libraries, since they could cause other errors.
0
 
LVL 85
ID: 40420019
It's quite common to see issues with common functions like Left, Right, etc from a missing reference, even if the reference has no bearing on those common functions.

You must fix or remove the reference. Once you do that the error you're reporting should go away.
0
 

Author Closing Comment

by:pdvsa
ID: 40420305
thank you for the expert help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question