473,659 Members | 2,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DateDiff -1 problem

I have two date fields:

InitialDate
InspDate

I've tried to use a Datediff expression within an IIF function (see below)
in an unbound textbox to give me the amount of days elapsed between
InitialDate and current date:
- after 6 days have elapsed from the InitialDate and
- only if the InspDate field is empty.

But, if the InspDate field is populated, then there would be a blank field
in the unbound text box.
The expression that I tried to use is:

=IIf(IsNull([InspDate]),DateDiff("d",[InitialDate],Date())>6,"")

The result is that it does recognize the 6 days elapsed but it expresses it
as -1.
It does not give me the actual number of days elapsed.
And if the days elapsed is within 6 days difference, it produces a result of
zero.
please help.
Nov 13 '05 #1
1 2068
=IIf(IsNull([InspDate]) and DateDiff("d",[InitialDate],Date())>6,
DateDiff("d",[InitialDate],Date()),"")

Pete
"John T." <g4****@hotmail .com> wrote in message
news:42******** *************** @news.optusnet. com.au...
I have two date fields:

InitialDate
InspDate

I've tried to use a Datediff expression within an IIF function (see below)
in an unbound textbox to give me the amount of days elapsed between
InitialDate and current date:
- after 6 days have elapsed from the InitialDate and
- only if the InspDate field is empty.

But, if the InspDate field is populated, then there would be a blank field
in the unbound text box.
The expression that I tried to use is:

=IIf(IsNull([InspDate]),DateDiff("d",[InitialDate],Date())>6,"")

The result is that it does recognize the 6 days elapsed but it expresses
it
as -1.
It does not give me the actual number of days elapsed.
And if the days elapsed is within 6 days difference, it produces a result
of
zero.
please help.

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7143
by: News Central | last post by:
To all! I use the DateDiff function using VB6 and get this error 'Wrong number of argument or invalid property assignment' ... have anyone seen this problem? thanks ....
4
4093
by: CJM | last post by:
I have an ASP page that lists files and folders in a directory. I'm using a cookie to record the last time this page was visited, and I intend to show links that are created/modified from that date minus 30mins to the present... eg effectively new and modified files: If DateDiff("n", subfolder.DateLastModified, sLastVisit ) < 30 Then.... etc On my test machine this mechanism works OK, but on the live server (Win2k, IIS5) I get some...
8
5922
by: inamori | last post by:
I face that problems 07/01/2003 06/30/2006 ---------> it should be 3 01/01/2003 02/28/2005 --------->could i get 2 years and 2 months 01/01/2003 03/01/2005 --------->could i get 2 years and 2 months and 1
6
16511
by: Lofty | last post by:
Hi all. I have to write an app that interacts with mySQL (I really must have done some evil, evil stuff in a previous life to be landed with this!) I need to work out the difference in days between values in the database and the current date. "No problem," thought I , "I'll just use the SQL DATEDIFF command." Heh! Well, the user interface I'm using didn't even recognise DATEDIFF as being a function, so I decided to visit the mySQL...
4
11910
by: Paolo | last post by:
I am having some problem with a Year Function. I have form on which I have 4 field which indicate dates and an additional form which sums those dates: These are the fields: YEARS STARTINGDATE1 ENDINGDATE1 STARTINGDATE2
3
1939
by: chanchito_cojones | last post by:
i have a question regarding the DateDiff function. I am quite new to access and seem to have hit a snag with this function. My problem is as follows: I have a table field that list a persons DateOfBirth. The standard format for this field is yy.mm.dd (ie- 73.02.01). And on the form that the field is brought into the input mask for the field is 00.99.99;0;_ What i want to do is have another field on the form that generates the persons...
7
15488
by: Adrian | last post by:
I hit on this problem converting a VB.NET insurance application to C#. Age next birthday calculated from date of birth is often needed in insurance premium calculations. Originally done using DateDiff in VB.NET which is only available in C# if you don't mind linking in Microsoft.VisualBasic.dll to your C# application. I wanted to avoid this so set about a pure C# solution which uses a combination of TimeSpan in whole days and the...
6
7641
by: kevinjwilson | last post by:
I am trying to get the date difference between two dates but I don't want the function to include weekends in the calculation. Does anyone have an idea on how to make this work?
12
2181
by: TofuTheGreat | last post by:
I did a group search and found hundreds of cases of problems with DateDiff(). I read through several dozen but they didn not apply to my situation. Not having the time to read through all of them I'm hoping that I'll get an answer here. The software scenario. IIS 5.0 running on Windows Server 2000. The application is a campsite reservation system. The application starts with a simple HTML form that people enter an arrival date and a...
0
8428
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8747
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7356
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
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
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.