Do you have two layouts with the same name?
You could try substituting LayoutNumber for LayoutName and see if you get a different result. That would address the issue Javier refers to.
In fact, I don't have 2 layouts having the same name.
What I have is a folder name having the same name as this layout (as you know, the folder that is added to organize our layouts).
This happenned to be true for those 2 layouts and 2 folders.
When I changed the folder name, everything went good.
I didn't know that folders are treated as layouts!
Thank you for the hint.
Thank you for the reply.
But I don't think that Layout Number could work with this function.
1. I can't really explain why your problem went away after changing your folder names, but I can say that my own testing shows that folders are definitely NOT treated as layouts.
2. Re "I don't think that Layout Number could work with this function", my booboo, sorry.
This is what I knew.
I tried also to do a similar database, but I found no problem having similar layout and folder names.
I don't know what was the problem.
But doing those steps resolved my problem.