I thought I knew something about Access and functions but obviously I don't know enough!
Very simple report, printing all the addresses in a database
Rather than concatenating the first name and surname and all the lines of the address in the control source box I thought I'd have a function or two to make it simpler.
So I have:
Function CallMe()
CallMe = Trim$([Surname] & " " & IIf(IsNull(Fornames$), "", Trim$(Forname$)))
End Function
Then I try to set a text box source to =CallMe() and
When I try print preview I get the oh so helpful #Error
I've tried Me.[Surname] etc with the same result
I thought all fields in the current record were available in functions.
What has me even more puzzled is that whilst trying this out I rewrote it passing Surname as a parameter and SOMETIMES I could access Fornames without passing it and sometimes I could not.
Please someone tell me what I'm overlooking.
Thanks
Very simple report, printing all the addresses in a database
Rather than concatenating the first name and surname and all the lines of the address in the control source box I thought I'd have a function or two to make it simpler.
So I have:
Function CallMe()
CallMe = Trim$([Surname] & " " & IIf(IsNull(Fornames$), "", Trim$(Forname$)))
End Function
Then I try to set a text box source to =CallMe() and
When I try print preview I get the oh so helpful #Error
I've tried Me.[Surname] etc with the same result
I thought all fields in the current record were available in functions.
What has me even more puzzled is that whilst trying this out I rewrote it passing Surname as a parameter and SOMETIMES I could access Fornames without passing it and sometimes I could not.
Please someone tell me what I'm overlooking.
Thanks