And if you already have an open connection somewhere in the program, it would probably be better to change the function to take it as a parameter instead of opening another connection.
You're awesome! That did it!
Many thanks!
If I already had an open connection elsewhere, what would this code look like?