help with this code?

alexi

Registered User.
Local time
Tomorrow, 02:28
Joined
Feb 26, 2003
Messages
65
can someone help me with this code?
Function DayOfyear(Optional dteDate As Date) As Long

If CLng(dteDate) = 0 Then
dteDate = Date
End If

DayOfyear = Abs(DateDiff("d", dteDate, DateSerial(Year(dteDate) - 1, 6, 30)))
End Function


Sub Test()

MsgBox (DayOfyear * 0.0547945)

End Sub

in the day of year = abs....... i need the 1,6,30 to be entered by an input box or somethin like that. this is the date that the function runs off. but i need to be able to enter it?
anyideas?
 
I don't understand what you're trying to do?

Abs(DateDiff("d", DATE(), DateSerial(Year(date()) - 1, 6, 30)))

gives the sames result as

date()-cdate("6/30/2002")

Are your trying to input Month, Day and Year in different fields and then calculate the difference in days? If so,

date()-cdate(me!txtmonth & "/" & me!txtDay & "/" & me!txtyear)

or

date()-cdate(forms!YourForm!txtmonth & "/" & forms!YourForm!txtDay & "/" & forms!YourForm!txtyear)
 

Users who are viewing this thread

Back
Top Bottom