Solved

Error on Compile - Cant find project or library

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

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

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

739 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