Default date value question

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

Guest

hi there,

I'm looking to have a date value default to the NEXT 10th of the month. So
if today is the August 11 I it should come up as september 10 and if today's
August 9 then the field should come up as August 10.

hulp! =)

Thanks all
 
Problem solved

Public Function TenthDateOfNextMonth()

Dim dateNow As Date
Dim dateLater As Date
Dim day As Integer

dateNow = Date
day = DatePart("d", dateNow)


If (day > 10) Then
dateLater = DateAdd("m", 1, dateNow)
day = 0 - (day - 10)
dateLater = DateAdd("d", day, dateLater)
ElseIf (day < 10) Then
day = 10 - day
dateLater = DateAdd("d", day, dateNow)
Else
dateLater = dateNow
End If

TenthDateOfNextMonth = dateLater

Exit_Procedure:
Exit Function
Error_Handler:
MsgBox "An error has occurred."
Resume Exit_Procedure
Resume

End Function
 
Back
Top