Solved

Error on Compile - Cant find project or library

Posted on 2014-11-03
9
211 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 45

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 250 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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 250 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

Technology Partners: 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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

724 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