Solved

Error on Compile - Cant find project or library

Posted on 2014-11-03
9
193 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
  • 2
  • 2
  • 2
  • +2
9 Comments
 
LVL 28

Expert Comment

by:omgang
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 5

Expert Comment

by:ReneD100
Comment Utility
Look in the VBA editor at Tools/References. There is probably a missing reference that is causing the error.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:pdvsa
Comment Utility
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
Comment Utility
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 84
Comment Utility
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
Comment Utility
thank you for the expert help.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now