So I would do something like this: Loop If getkey()<>0 Then getkey()->key While key=(what ever number) (do what ever) EndWhile While key=(another #) (do somethig else) EndWhile Like that?