Passing Records and RecordRefs via Variants

As developers in an ever more repeatable world we should strive to write code in ways that make it as flexible and generic as we possibly can. A trick I use is too pass things around in ever more generic ways by using Variants.

A good example can be seen below where the function ReturnRecordIDasText function takes either a Record or a RecordRef as input and then returns the RECORDID as text.

The important thing to notice here is of course that the function can take more than one datatype as input giving the function even greater usability.

Before anybody notice I better say that passing variables by reference is a limitation of the example above. Still a good trick though according to me.

Hopefully you find this trick useful too.

PS. I have seen Waldo use the same trick in a slightly different way, so credit should absolutely also go to him in this case.