PC Review


Reply
Thread Tools Rate Thread

Access 2003 Date format

 
 
=?Utf-8?B?TWlja2V5?=
Guest
Posts: n/a
 
      9th Nov 2006
I have a table designed to reflect employees, Vacation information and
attendance information. I would like to show the years of service in the
company in a field in the form. How? Please help. Your assistance would be
much appreciated. I am new at this development programming in access
 
Reply With Quote
 
 
 
 
Graham R Seach
Guest
Posts: n/a
 
      9th Nov 2006
Mickey,

There are a couple of ways you can do that; an accurate way, and an
inaccurate (yet possibly acceptable) way.

The inaccurate way is to place the following pseudo-code into the
txtYearsofService textbox's ControlSource property:
=DateDiff("yyyy", [DateStarted], Date())
This will only return the number of years.

The accurate way is to place the following pseudo-code into the
txtYearsofService textbox's ControlSource property:
=Diff2Dates("dmy",[DateStarted], Date(), False)
This will (selectively) return the number of years, months, days, hours,
minutes and seconds.

....but before you try this last sugestion, download the code found at
http://www.pacificdb.com.au/MVP/Code/Diff2Dates.htm, and place it in a
standard module.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

"Mickey" <(E-Mail Removed)> wrote in message
news3672B69-0B0E-4D83-8709-(E-Mail Removed)...
>I have a table designed to reflect employees, Vacation information and
> attendance information. I would like to show the years of service in the
> company in a field in the form. How? Please help. Your assistance would
> be
> much appreciated. I am new at this development programming in access



 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      9th Nov 2006
There's also an intermediate possibility.

=DateDiff("yyyy", [DateStarted], Date()) will return the wrong answer if the
anniversary of DateStarted hasn't yet occurred this year. For example, if
someone starts 2006-12-31, on 2007-01-01 DateDiff("yyyy", [DateStarted],
Date()) will return 1.

To correct for that, use

=DateDiff("yyyy", [DateStarted], Date()) - _
IIf(Format(Date(), "mmdd") < Format([DateStarted], "mmdd"), 1. 0)


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


"Graham R Seach" <gseach@accessmvp_REMOVE.com> wrote in message
news:eMMgZ4%(E-Mail Removed)...
> Mickey,
>
> There are a couple of ways you can do that; an accurate way, and an
> inaccurate (yet possibly acceptable) way.
>
> The inaccurate way is to place the following pseudo-code into the
> txtYearsofService textbox's ControlSource property:
> =DateDiff("yyyy", [DateStarted], Date())
> This will only return the number of years.
>
> The accurate way is to place the following pseudo-code into the
> txtYearsofService textbox's ControlSource property:
> =Diff2Dates("dmy",[DateStarted], Date(), False)
> This will (selectively) return the number of years, months, days, hours,
> minutes and seconds.
>
> ...but before you try this last sugestion, download the code found at
> http://www.pacificdb.com.au/MVP/Code/Diff2Dates.htm, and place it in a
> standard module.
>
> Regards,
> Graham R Seach
> Microsoft Access MVP
> Sydney, Australia
>
> "Mickey" <(E-Mail Removed)> wrote in message
> news3672B69-0B0E-4D83-8709-(E-Mail Removed)...
>>I have a table designed to reflect employees, Vacation information and
>> attendance information. I would like to show the years of service in the
>> company in a field in the form. How? Please help. Your assistance
>> would be
>> much appreciated. I am new at this development programming in access

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: convert access date Format() to French date , use of ORDER BY SQL Ken Snell \(MVP\) Microsoft Access Queries 1 28th Nov 2008 03:10 PM
How do I change the FORMAT of a date in Access 2003? =?Utf-8?B?UmhlYVM=?= Microsoft Access 4 20th Jun 2006 01:55 AM
Converting Date Format from YYYY-MM-DD to Access date format =?Utf-8?B?YWN0aXZlZ2lybA==?= Microsoft Access 3 21st Jun 2005 11:03 PM
Export Outlook date field as date/time format to Access database =?Utf-8?B?QmVja3k=?= Microsoft Outlook Discussion 0 2nd Dec 2004 02:49 PM
How to convert Excel serial date into Access date format? RADO Microsoft Access 2 27th Dec 2003 12:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:37 PM.