A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Datediff help



 
 
Thread Tools Display Modes
  #11  
Old February 7th, 2006, 10:33 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Datediff help

Yes, that's the problem.

If 17YRCADD doesn't have a value in it, what do you want to do?

To have it use today's date instead, you could use:

=Abs(DateDiff("yyyy",Me.txtBDATE,Nz(Me.txt17YRCADD ,
Date()))+(Format(Me.txtBDATE,"mmdd")Format(Nz(Me. txt17YRCADD,
Date()),"mmdd")))

To have it report a problem, you could use:

=IIf(IsNull(Me.txt17YRCADD), "Problem",
Abs(DateDiff("yyyy",Me.txtBDATE,Me.txt17YRCADD)+(F ormat(Me.txtBDATE,"mmdd")Format(Me.txt17YRCADD,"m mdd"))))



--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


wrote in message
oups.com...
As a test, i tried the expression that does work using Now and 17YRCADD
as the date instead of BDATE. I get the same #name error, so the
problem seems to be with the 17YRCADD field. I looked through the data
in that field and the only difference I can see between that and BDATE
is that all of the records have a date in BDATE but not all have a
17YRCADD date. I didn't think this would be a problem in the records
where there was an entry in 17YRCADD. Could this be the problem?



  #12  
Old February 7th, 2006, 11:04 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Datediff help

I don't understand why it doesnt work on any of the records when only
some of the records don't contain both dates. How is Access dealing
with this that it wants dates in all the fields before it will run that
expression on any of the records? I have a number of Access books and
none of them have been any help in understanding this issue.

  #13  
Old February 7th, 2006, 11:12 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Datediff help

I tried the expression to have it report a problem. it gave me the
same #name error in all of the records. BDAY is birthday. 17YRCADD is
a test that was given at some point in time, between the ages of 16 and
20. I am trying to figure out the age at the time the test was given,
not as of today so using todays date wouldnt help.

I can't believe that this database is incapable of performing a
calculation between 2 date fields unless every single record in the
table has dates in both fields. No other database that I have ever
seen has such an astounding limitation. Are you telling me that unless
BDATE and 17YRCADD both have a date in every record, Access can not
perform a calculation to determine the age?

  #14  
Old February 8th, 2006, 12:42 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Datediff help

No, I'm not telling you that.

Either you've made a mistake typing something, or there's something else
about your data that you haven't noticed.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


wrote in message
oups.com...
I tried the expression to have it report a problem. it gave me the
same #name error in all of the records. BDAY is birthday. 17YRCADD is
a test that was given at some point in time, between the ages of 16 and
20. I am trying to figure out the age at the time the test was given,
not as of today so using todays date wouldnt help.

I can't believe that this database is incapable of performing a
calculation between 2 date fields unless every single record in the
table has dates in both fields. No other database that I have ever
seen has such an astounding limitation. Are you telling me that unless
BDATE and 17YRCADD both have a date in every record, Access can not
perform a calculation to determine the age?



  #15  
Old February 8th, 2006, 09:06 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Datediff help

Given that the expression is typed correctly, both fields are set as
date/time fields, there is no erronious data in those fields, the
correct table is attached to the form and the text boxes on the form
are named differently that the fields in the table, and the expression
is in the control souce of an unbound text box, do you have any other
ideas as to why all of the expressions that you gave me won't give me
an age for those records that have both a BDATE and 17YRCADD date? I
am at a complete loss.

  #16  
Old February 9th, 2006, 12:27 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Datediff help

Sorry, so am I.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


wrote in message
oups.com...
Given that the expression is typed correctly, both fields are set as
date/time fields, there is no erronious data in those fields, the
correct table is attached to the form and the text boxes on the form
are named differently that the fields in the table, and the expression
is in the control souce of an unbound text box, do you have any other
ideas as to why all of the expressions that you gave me won't give me
an age for those records that have both a BDATE and 17YRCADD date? I
am at a complete loss.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DateAdd & DateDiff Problems Paul Using Forms 1 December 18th, 2005 12:38 PM
DateDiff command - no negative numbers mix Using Forms 6 August 11th, 2005 12:02 PM
Faulty Datediff (Access 2003) Henning General Discussion 2 June 12th, 2005 05:14 PM
DateDiff() Function ltamisin General Discussion 2 May 31st, 2005 12:03 PM
Datediff function and date format mscertified New Users 1 February 12th, 2005 01:01 AM


All times are GMT +1. The time now is 03:06 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.