What triggers this error message?

It seems you are using that function in the wrong kind of window (e.g. a form). Make sure your procedure activates the data sheet before you use this function.

The visiblefieldnumbers( function is used in the code of both the firstcolumn and lastcolumn statement code so either of these need to be run with the data sheet front-most as well.

Thank you.

So many details to worry about…

The documentation for these statements is short, but includes this: This statement should only be used in data sheet windows. There are no “columns” in a form, so these statements make no sense in that context.

On the other hand, it would be better if the error that occurs in this situation was clearer, so I have changed this for the next release. Instead of seeing an error about visiblefieldnumbers(, you’ll now get an error that mentions that the firstcolumn (or lastcolumn) statement is the problem.