Hi,
Sorry to be reopening this thread. but i am still unable to get this solved. The code i have used is - 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
11 1806
I think your problem is with Date - 3. If you are referring to the system date, the syntax should be as follows: Date() - 3
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.
Since Access is looking for an SQL string clause without the "WHERE", I think you should try something like: - "DateFieldInQuery = #" & Date() - 3 & "#"
"DateFieldInQuery" 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.
Since Access is looking for an SQL string clause without the "WHERE", I think you should try something like: - "DateFieldInQuery = #" & Date() - 3 & "#"
"DateFieldInQuery" 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?
But would this not be a query? how do i insert this in the where clause in the code?
-
"SELECT * FROM Tablename WHERE Datefieldname = # " & Date() - 3 & "#"
-
The way that you would put that into your openreport command is as follows: -
DoCmd.OpenReport "NameOfTheReport", acViewPreview, , "Datefieldname = # " & Date() - 3 & "#"
-
The way that you would put that into your openreport command is as follows: -
DoCmd.OpenReport "NameOfTheReport", acViewPreview, , "Datefieldname = # " & Date() - 3 & "#"
-
I still get the same error message. "Cannot find project or library" and the 'date' in the code is highlighted.
try:
Format(Date(),"mm/dd/yyyy") - 3
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
Hi. When Date() is no longer recognised as a valid function the problem seems to arise as a result of missing or incorrect project references for that installation, as MTB said. To trace which one it may be best to compare the project references for the 'problem' installation to those for a 'known good' PC running Access with no problems.
I experienced this on a laptop installation, and all the development databases I was working on failed on normal built-in functions - Date was just one of many that caused compile errors and other completely daft symptoms. There was a missing reference in my case, but in others I know of it was a conflicting reference (to the wrong version of a DLL). It's really annoying because there is actually nothing wrong with the underlying DBs or their code, and trying to trace non-existent errors is such a fruitless task.
-Stewart
Hi. When Date() is no longer recognised as a valid function the problem seems to arise as a result of missing or incorrect project references for that installation, as MTB said. To trace which one it may be best to compare the project references for the 'problem' installation to those for a 'known good' PC running Access with no problems.
I experienced this on a laptop installation, and all the development databases I was working on failed on normal built-in functions - Date was just one of many that caused compile errors and other completely daft symptoms. There was a missing reference in my case, but in others I know of it was a conflicting reference (to the wrong version of a DLL). It's really annoying because there is actually nothing wrong with the underlying DBs or their code, and trying to trace non-existent errors is such a fruitless task.
-Stewart
Well the int(Now()) command helps. Thanks guys......
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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.
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |