473,586 Members | 2,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date queries

47 New Member
Hi,

Sorry to be reopening this thread. but i am still unable to get this solved. The code i have used is
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "NameOfTheReport", acViewPreview, , Date - 3
I get an error message saying "Compile Error : Can't find project or library"

If this is closed out, i can deliver my project. Please help!!!

Thanks
Neo
Jul 24 '08 #1
11 1821
puppydogbuddy
1,923 Recognized Expert Top Contributor
I think your problem is with Date - 3. If you are referring to the system date, the syntax should be as follows: Date() - 3
Jul 25 '08 #2
neosam
47 New Member
I think your problem is with Date - 3. If you are referring to the system date, the syntax should be as follows: Date() - 3

When i tried doing that, the paranthesis () just disappeared. and it ended up being the way it is now. Am unable to change that.
Jul 25 '08 #3
youmike
69 New Member
Since Access is looking for an SQL string clause without the "WHERE", I think you should try something like:

Expand|Select|Wrap|Line Numbers
  1. "DateFieldInQuery = #" & Date() - 3 & "#"
"DateFieldInQue ry" is whatever is the name that you have assigned in the query to the date you want to test. The # before and after tells Access that the number returned by Date() - 3 should be teated as a date.
Jul 25 '08 #4
neosam
47 New Member
Since Access is looking for an SQL string clause without the "WHERE", I think you should try something like:

Expand|Select|Wrap|Line Numbers
  1. "DateFieldInQuery = #" & Date() - 3 & "#"
"DateFieldInQue ry" is whatever is the name that you have assigned in the query to the date you want to test. The # before and after tells Access that the number returned by Date() - 3 should be teated as a date.
But would this not be a query? how do i insert this in the where clause in the code?
Jul 25 '08 #5
PianoMan64
374 Recognized Expert Contributor
But would this not be a query? how do i insert this in the where clause in the code?
Expand|Select|Wrap|Line Numbers
  1. "SELECT * FROM Tablename WHERE Datefieldname =  # " & Date() - 3 & "#"
  2.  
Jul 25 '08 #6
PianoMan64
374 Recognized Expert Contributor
The way that you would put that into your openreport command is as follows:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "NameOfTheReport", acViewPreview, , "Datefieldname =  # " & Date() - 3 & "#"
  2.  
Jul 25 '08 #7
neosam
47 New Member
The way that you would put that into your openreport command is as follows:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "NameOfTheReport", acViewPreview, , "Datefieldname =  # " & Date() - 3 & "#"
  2.  
I still get the same error message. "Cannot find project or library" and the 'date' in the code is highlighted.
Jul 25 '08 #8
puppydogbuddy
1,923 Recognized Expert Top Contributor
try:
Format(Date()," mm/dd/yyyy") - 3
Jul 25 '08 #9
MikeTheBike
639 Recognized Expert Contributor
Hi

I have had this problem a few times over the years. It seems to be a referencing problem (perhaps when using A2000 on a DB created in A2003 but in A2000 format), and yes the parentheses do disappear when Date() is used. These only seem necessary in Query designer. I have never found a satisfactory answer to this, but in the past, in desperation, I have resorted to Int(Now()) in stead of Date !!


MTB
Jul 25 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

6
6079
by: BlackFireNova | last post by:
Using Access 2002 I am writing a report which draws data from several different tables. I can't link all the tables in a query, as some can not be related without truncating the data. I plan to use sub-queries and sub-reports to filter and display the data in the unrelated tables in my report. The common information is a user-inputed...
1
2040
by: EnriqueM | last post by:
One question: I created an access database that has been extremely useful in my work. I dont' even know at what level of knowledge I am at. I read a lot about how to create a database, created many tables, connected them and then created different kinds of queries. (One thing I have never done is reports, because I really don't need them) I...
5
1594
by: David B | last post by:
I have a number of queries, running one after the other, which do quite a complex calculation. A text box on a form provides the date for this routine. I have another routine I wish to do and it happens that the final query in the above routine contains the data I need. However I don`t want to fire this routine from the same form as before....
1
2470
by: Ken | last post by:
I wrote a function to use in queries that takes a date and adds or subtracts a certain length time and then returns the new value. There are times when my function needs to return Null values. Function DateCalc (blah...) As Variant Do Stuff... If Not IsNull(varNewDate) Then DateCalc = varNewDate End If End Function
10
2966
by: Kenneth | last post by:
I have a Query that consist of a lot of different sales data, and one of the colums are different date. The date goes from 1jan2003 til 31jan2003. in this Query I only want the salesdata for 1jan2003. How do I remove the dates , 2jan2003 til 31jan2003 without removing them from the table, from the Query? (Because I want to use the data for...
2
2244
by: carl.barrett | last post by:
Hi, I'm back with the same question as I still can't get it to display my data the way I want it to. The table lists information about a perpetrator involved with an anti social behaviour order. The table contains personal information about the individual as well as (here is where the letter dates comes in:) e.g.
6
17909
by: Tony Miller | last post by:
All I have an aggregate query using the function Month & Year on a datereceived field ie: TheYear: Year() TheMonth: Month() These are the group by fields to give me a Count on another field by year & month When I try to place a date filter 'Between x And y ' on an expression field
9
6017
by: mharrison | last post by:
Hello, I am developing a small java web-based car-pool booking system app which interacts with an access database. I am trying to write 2 queries: The first which will specify whether a given car is available on a given date range e.g. from: 1/12/05 to 12/12/05. the second which will run if the first query is unsuccessful e.g. a list of other...
19
1695
by: eskelies | last post by:
I have two queries. My goal is to pull a range of numbers that fall on or in a certain date range. For example, $100 on 9/1/2007 and $200 on 9/24/2007. I want the date range to pick up both the 100 and 200 dollars. From there I will sum them. The key is I only want current month. The following SQL is already written for both Queries. My...
3
4403
by: murch.alexander | last post by:
I made a simple public function to set and return a date value (see below). I have a number of queries that call up the function to get the "As Of Date," which is typically set to today's date. Occasionally though, I need to change the "As Of Date" to some date in the past, and then when I run the queries, they're based on that date in the...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.