Hi Jay.
Actually there is a way to do this in one line, but I'd never do it :-)
The Exact one line replacement for that code is -
ExecScript(Iif(Used("Schedule"), "Use Schedule in 0", "Select Schedule"))
If you would rather always be on the table when you are done, rather than only when it's already open, which seems likely, you can use -
ExecScript(Iif(Used("Schedule"), "", "Use Schedule in 0"+ Chr(13)) +"Select Schedule")
Of course, you're much better off doing it with a simple function call. It would take less typing, be easier to read, less error prone and you can add additional parameters as you need them to handle things like aliases, orders etc.
Ian Simcock.
>I know there is some way of putting this on one line using IIF (I think), but I just can't recall it right now. Thanks!
>
>
>IF !USED('Schedule')
> USE Schedule IN 0
>ELSE
> SELECT Schedule
>ENDIF
>