lcDBC = cursorgetprop('database') && hopefully this will contain the name of the dbc() for the table being operated on but I am not sure * --- Open table of next keys If USED("NextKey") and dbc('database','nextkey')<>lcDBC use in NextKey endif If USED("NextKey") select nextkey else Use (lcDBC+'!'+'nextkey') EndifI dont have the time to make and test this myself so I am hoping someone else has already done this somewhere