Kaup, Chester A
kaupca at chevrontexaco.com
Tue Jul 20 09:50:17 CDT 2004
Good explanation. The way I was trying to do it confuses the format function. I think I will use the Right function. Chester Kaup Information Management Technician IT-MidContinent/MidContinent Business Unit CTN 8-687-7415 Outside 432-687-7414 No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, July 20, 2004 9:21 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Date format problem Hi Chester If the year is saved as 2004 you can retrieve the deca and single years like this: intShortYear = FullYear Mod 100 If FullYear is a String - as in a combobox - you can do this: strShortYear = Right(FullYear, 2) The reason you are confused is that 2004 is a year and not the date value you expect as you can see from this: ? Format(2004, "mm/dd/yyyy") If you insist on using Format() you must build a DateTime value from the year, say 2004-01-01: datDate = DateSerial(2004, 1, 1) Doing so, Format(datDate, "yy") will return "04". /gustav > All I want is the last 2 digits of the year. It needs to be that way > to load into another program. >> Selected year contains the value 2004. It can contain any year value >> from 2001 to 2010 depending on what the user selects from the list >> box. >> >> The following expression in a query returns 2004 Test:[Forms]![frm >> Select Date]![selected_year] >> The following expression returns 05 in a query >> Test:Format([Forms]![frm Select Date]![selected_year],"yy") >> >> I an confused as to what is happening here. Help please. -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com