Function wont function or save! (1 Viewer)

Kassy

Registered User.
Local time
Today, 13:16
Joined
Jan 25, 2006
Messages
66
Batt17 provide this function which I have compiled and tried to use via a text box on a form. I type in = CheckSeason() in control source of the properties box (Ive aslo tried typing in =SeasonPaid() ) and save the form however when I go back to check the cotrol is blank and the properties show it has not been saved. After several attempts to save it in case I had made a mistake I tried using it in a new form I created to see if it would work but again it wont save the function. I saved the function as 'SeasonPaid'.

Option Compare Database
Function CheckSeason(PaymentDate As Date) As Integer

If Format(PaymentDate, "mmdd") > "0831" Then
CheckSeason = Year(PaymentDate) + 1
Else
CheckSeason = Year(PaymentDate)
End If

End Function
 
Last edited:

david.brent

Registered User.
Local time
Today, 13:16
Joined
Aug 25, 2004
Messages
57
I'm not entirely sure about the exact problem but it looks like you have to pass a date into the function.

Function CheckSeason(PaymentDate As Date) As Integer

So I would say when you're setting the control source of the text box instead of

= CheckSeason()

shouldn't it be

=CheckSeason(SomeDate)

Might solve the problem.

Take care
 

Kassy

Registered User.
Local time
Today, 13:16
Joined
Jan 25, 2006
Messages
66
Yes thats right but...

Yes your perfectly right it saves it now Ive added the date into it BUT I cant get the right format, have tried several ways but get year 1900 for most, but at least it now saves. I really need to set date to 'Sep 1st' with no Year because I want the year according to the System date. Thanks
 

Users who are viewing this thread

Top Bottom