modify this code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

=DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") < Format(
[Birthdate], "mmdd") )

I want to modify this code to show months and years

anyone help please.
 
Thankyou very much but I'm not understanding how to do this. Where would I
put the code and how would it work. I have 1 field called Start date and a
Text box called worked. I want to find the difference between Start date and
Current date. Sorry to be pain.

Allen Browne said:
See:
http://www.accessmvp.com/djsteele/Diff2Dates.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Lawrence said:
=DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") <
Format(
[Birthdate], "mmdd") )

I want to modify this code to show months and years

anyone help please.
 
Copy everything between Code Start and Code End into a new module (not a
class module). Make sure you do not name the module Diff2Dates: modules
cannot have the same name as routines within them.

As the control source for the textbox worked, put =Diff2Dates("ym",
Me.[Start date], Date())

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Lawrence said:
Thankyou very much but I'm not understanding how to do this. Where would I
put the code and how would it work. I have 1 field called Start date and a
Text box called worked. I want to find the difference between Start date
and
Current date. Sorry to be pain.

Allen Browne said:
See:
http://www.accessmvp.com/djsteele/Diff2Dates.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Lawrence said:
=DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") <
Format(
[Birthdate], "mmdd") )

I want to modify this code to show months and years

anyone help please.
 
Back
Top