Solved

Error on Compile - Cant find project or library

Posted on 2014-11-03
9
207 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
Independent Software Vendors: 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!

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

763 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