Ok, like Linq said, we still don't know what you are doing. But I can tell you what to do to get the results you are looking for, what you need to do:
1. Assume you have a text box named
txtYear
2. Create another text box and go to its properties and put "
=DaysInYear([txtYear])" in the control source field. (no double quotes!)
3. Keep this code with the tweak I put in:
- Public Function DaysInYear (ByVal Year As Integer) As Integer
-
-
Dim LeapDays As Integer
-
LeapDays =0
-
If Year Mod 4 = 0 Then LeapDays = 1
-
DaysInYear = 365 + LeapDays
-
End Function
4. No need for the
GetDaysInYear function or any buttons.
What should happen now is that immediately after the user enters a year, the other text box will automatically display the number of days for you.
Try this,
-AJ