>>>loPage=evaluate("thisform.t48_page_frame1."+m.cLastPage)
>>>loPage.Activate()
>>
>>I'd rather not use evaluate() either, if possible. Instead of passing the page's name (which we can't be too sure of, i.e. can anyone be sure the 4th page will be named page4, and that the "page"+trans(i) will give the right name for each page?), I prefer passing the page's number, and then
>>
loPage=thisform.t48_page_frame1.pages[m.<b>n</b>LastPage]
>>so we don't impose any assumptions as to the page's name (actually, Page1, Page2 etc make sense only while there are not more than four of them). I apply the same thing to grid.columns[n], optiongroup.buttons[n] etc - anywhere where I can get the object reference without involving the names.
>
> The only problem here, what you should know this
n, for me it sometimes simpler to use column (page) names instead of number. Besides, I usually give a meangful name to grid columns/pages, so I can easily recognize them, if needed.
If you know the page's name, you can then pass its .pageorder, but then I'd rather pass a reference to the page object than the page's name - yet another way to avoid the macro. I'm really curious to know which one of these would be faster (here's the cases, in order of appearance):
- passing the page's name and using it as a macro
- passing the page's name and evaluating to an object using eval()
- passing the page's number and getting an object reference using ...pages[n]
- passing an object reference to the page
By "faster" I mean both the time needed to write/debug/maintain and the runtime benchmarks.