Jul 9, 2004 #1 ocan Programmer Jun 28, 2004 31 US On a form, in 1 text box, how could I type in: julian date-----(three digit day)(last 2 digits of the year) and in another text box return the date. ie. type in 00104 & have it return 1/1/04. Thanks
On a form, in 1 text box, how could I type in: julian date-----(three digit day)(last 2 digits of the year) and in another text box return the date. ie. type in 00104 & have it return 1/1/04. Thanks
Jul 9, 2004 #2 Dalain Technical User Jan 10, 2003 104 CA try this in the Lost Focus of the field that you enter the julian date. Private Sub JulianDateFieldName_LostFocus() me.NewDate = fJtoD(JulianDateFieldName) End Subin the lost focus field And the function that goes with it. Function fJtoD(strJulianDdate As String) As Date 'Convert Julian to a Date Dim strDate As String, lngYear As Long strDate = Mid(strJulianDdate, 1, 3) 'Number of days lngYear = Mid(strJulianDdate, 4, 2) 'Year fJulianDdate = DateSerial(lngYear, 1, 1) + strDate - 1 End Function Dalain Upvote 0 Downvote
try this in the Lost Focus of the field that you enter the julian date. Private Sub JulianDateFieldName_LostFocus() me.NewDate = fJtoD(JulianDateFieldName) End Subin the lost focus field And the function that goes with it. Function fJtoD(strJulianDdate As String) As Date 'Convert Julian to a Date Dim strDate As String, lngYear As Long strDate = Mid(strJulianDdate, 1, 3) 'Number of days lngYear = Mid(strJulianDdate, 4, 2) 'Year fJulianDdate = DateSerial(lngYear, 1, 1) + strDate - 1 End Function Dalain
Jul 9, 2004 1 #3 PHV MIS Nov 8, 2002 53,708 FR Something like this ? AnotherTextBox = DateSerial(Right(JulianDate, 2), 1, Left(JulianDate, 3)) Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244 Upvote 0 Downvote
Something like this ? AnotherTextBox = DateSerial(Right(JulianDate, 2), 1, Left(JulianDate, 3)) Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
Jul 10, 2004 #4 Dalain Technical User Jan 10, 2003 104 CA It figures, someone like PHV would find a shorter way. I didn't think DateSerial would work if the day value was grater than 31, but it does!! Dalain Upvote 0 Downvote
It figures, someone like PHV would find a shorter way. I didn't think DateSerial would work if the day value was grater than 31, but it does!! Dalain