'#Type' showing in form field when I set a function to be the default value (1 Viewer)

GoodyGoody

Registered User.
Local time
Today, 20:40
Joined
Aug 31, 2019
Messages
120
Hi, I have a form field which is taken form an Integer field on a table. I want to default a value into this field so have written a function which returns and integer value. However, when I set this function to be the default value of the field the form shows #Type in the field. What am I doing wrong?

Code:
Function GetSeriesRunnerNumber(intRaceEventID As Integer, intRaceRunner As Integer) As Integer
.....
End Function

Thanks
Stephen
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:40
Joined
Aug 30, 2003
Messages
36,128
What values are you passing to the function? If they are values from the record, they're probably null at the point the function runs.
 

GoodyGoody

Registered User.
Local time
Today, 20:40
Joined
Aug 31, 2019
Messages
120
The values are from other fields but I will check what's actually being passed. Thanks
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:40
Joined
Aug 30, 2003
Messages
36,128
No problem. The default value would be applied as soon as a new record is viewed, before any values had been filled in by the user. If that's the case, you might want to apply the function in the after update event of the control for the last of the required values to be input.
 

Users who are viewing this thread

Top Bottom