473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Help With Report

I think after this question i may have to invest in a book,

I have a report where i want to show the date of all computers that have expired if its equal to todays date or before.

So I have created a query to show the results i want, now i know all i need to do is input a piece of code into the criteria of the expiry date. The question is what code do i need.

A rough but wrong guess of mine was

IF [MACHINE]![Warrenty Finish]"<="Now()"

Any help would be great

Thanks
Nov 27 '06 #1
8 1193
PEB
1,418 Expert 1GB
I think after this question i may have to invest in a book,

I have a report where i want to show the date of all computers that have expired if its equal to todays date or before.

So I have created a query to show the results i want, now i know all i need to do is input a piece of code into the criteria of the expiry date. The question is what code do i need.

A rough but wrong guess of mine was

IF [MACHINE]![Warrenty Finish]"<="Now()"

Any help would be great

Thanks
If this is a query:

Try this one:
IIF([MACHINE].[Warrenty Finish]<=Now(),"Finished","Not Finished")

If in a report:
IIF(Reports![MACHINE]![Warrenty Finish]<=Now(),"Finished","Not Finished")
Nov 27 '06 #2
NeoPa
32,556 Expert Mod 16PB
Please don't use Now() for this.
Date() is the correct function here ;).
Nov 27 '06 #3
PEB
1,418 Expert 1GB
Please don't use Now() for this.
Date() is the correct function here ;).
Ade why don't like Now()? What about it?
Nov 27 '06 #4
NeoPa
32,556 Expert Mod 16PB
Ade why don't like Now()? What about it?
When comparing dates with Now() (which includes a time element), they are never equal.
Consider the following SQL snippet :
Expand|Select|Wrap|Line Numbers
  1. WHERE Now() Between MyTable.DateFrom AND MyTable.DateTo
If you had DateFrom as yesterday and DateTo as today would you expect this record to be included?
In fact it would not be.
Yesterday = 39,047; Today = 39,048 & Now() = 39,048.8599 which falls outside of the range.
Date() of course = 39,048 so would work exactly as expected.

If working with Date/Times, which is also needed a lot, then Now() is the correct thing to use.
Nov 27 '06 #5
PEB
1,418 Expert 1GB
When comparing dates with Now() (which includes a time element), they are never equal.
Consider the following SQL snippet :
Expand|Select|Wrap|Line Numbers
  1. WHERE Now() Between MyTable.DateFrom AND MyTable.DateTo
If you had DateFrom as yesterday and DateTo as today would you expect this record to be included?
In fact it would not be.
Yesterday = 39,047; Today = 39,048 & Now() = 39,048.8599 which falls outside of the range.
Date() of course = 39,048 so would work exactly as expected.

If working with Date/Times, which is also needed a lot, then Now() is the correct thing to use.
Sure u've right! Sometimes i'm using Int(Now()) to eliminate this element in the queries.. but when i introduce a document i use Now() for date/time stamp and the date and time of creation of the document...

And than i repass the document date using int() if i don't forget of course ;)
Nov 27 '06 #6
Sure u've right! Sometimes i'm using Int(Now()) to eliminate this element in the queries.. but when i introduce a document i use Now() for date/time stamp and the date and time of creation of the document...

And than i repass the document date using int() if i don't forget of course ;)
Tried the one for the query and received this error

"Data Type Mismatch in criteria expression"

Expand|Select|Wrap|Line Numbers
  1. IIF([MACHINE].[Warrenty Finish]<=Now(),"Finished","Not Finished")
the above code matches the table called MACHINE and matches the cell Warrenty Finish so it confuses me a little.

This is the format i use in the Warrenty finish cell 19/09/2010

Cheers.
Nov 28 '06 #7
Tried the one for the query and received this error

"Data Type Mismatch in criteria expression"

Expand|Select|Wrap|Line Numbers
  1. IIF([MACHINE].[Warrenty Finish]<=Now(),"Finished","Not Finished")
the above code matches the table called MACHINE and matches the cell Warrenty Finish so it confuses me a little.

This is the format i use in the Warrenty finish cell 19/09/2010

Cheers.
Anybody? tried to google the answer but am not really getting anywhere
Nov 28 '06 #8
NeoPa
32,556 Expert Mod 16PB
If you read all the answers posted then you would know not to use Now().
However, it sounds like your problem is with the date formatting.
Do you store the date as a string or a date/time?
If it is a Date/time then the format is irrelevant. SQL only works with dates in m/d/y format.
Where is your posted code? In VBA or in SQL?
If in SQL then you've got problems.
Nov 28 '06 #9

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

Similar topics

7
by: Phin | last post by:
I need your HELP! I've seen all the posts on using Crystal Reports within vs.net (vb.net) and changing a SQL query at runtime. When I tried to pass in a dataset into the crystal report at...
5
by: MGFoster | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've converted an ACC97 .mdb file to an ACC2K2 .adp. A report that worked in ACC97 doesn't work in ACC2K2. Report setup: ACC97 ...
1
by: Simon Matthews | last post by:
Hope someone can help an Access beginner! I've just started keeping my surgical logbook on access and it's a simple flat-file affair. I have created several queries that will list cases...
5
by: Steve Patrick | last post by:
Hi All You guys are my last hope, despite spending money on books and hours reading them I still can not achieve the results I need. I have designed a database in Access 2000 based on 1 table,...
15
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows...
3
by: Deasun | last post by:
I need some help please! Crystal is driving me nuts. Heres my code so far, see below. Problem: On the .export() line it comes back with error #5 Login failed! I know the login info is good so...
1
by: PlumeProg | last post by:
Hello, I can't find a way to bind a dataset at runtime as a source for my report source. I looked into msdn and found some sample : ms-...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
3
by: DeanL | last post by:
Hi guys, I'm in need of a little help with a report I'm setting up on Access 2000. The report shows data depending on entries on a form that has 7 fields (Min and Max Cost, Fiscal Year, Min and...
3
by: jambonjamasb | last post by:
Hi I have two tables: email_tbl Data_table Data table is is used to create a Form Data_form
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
agi2029
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.