>>Here's a method I use to determine the highest datasession number--the algorithm looks something like this: >> >>FOR i = 1 TO >> SET DATASESSION TO &i >> check if an error occurred >> if no error occurred >> i is now the highest known datasession >> endif >>ENDFOR >> >>If you want to know how many datasessions exist rather than the highest number, just change the logic to count rather than find the high datasession id. >> >>The art here is guessing how high to set so you don't miss any datasessions balanced against the time it takes to check each one (you don't want to check all 32K of the possibilities). I just pick some reasonable number, but you could also develop more sophisticated logic, such as: keep checking datasessions until you find 10 (or whatever) sequential unused datasessions. > >I don't know any other way but to have some sort of form mgr class or setup that has an array of form objects stored. You can roll thru the array finding the max datasession for the forms. > >Steve
See the code I posted. It will find the exact number of datasessions in any situation.