Just put opening of the table in TRY/CATCH block. And yes, you don't need to use macro in this case.
>I have several forms which are used to remove data and re-index a database. The all have a command of the form
>
>USE &lcTableName IN 0 EXCLUSIVE ALIAS dep_year_a
>
>where &lcUTableName ia "dep_year". The alias changes depending on the form. Preceding the USE command I have commands of the form
>
>IF USED(lcTableName)
> USE IN &lcTableName
>ENDIF
>
>IF USED('dep_year_a')
> USE IN 'dep_year_a'
>ENDIF
>
>
>
>If I use a form to add a record and then immediately invoke the form to remove and re-index the database I get the error message
>
>Error Number: 3
>
> Message: File in use
> Program Name: Program
> Line: n
>
>
>I know for sure if I get out of the application and re-enter it I do not get the error message, it also appears that if I invoke another form I do not get the error message.
>
>Any idea why and how to fix it?
>
>TIA
If it's not broken, fix it until it is.
My Blog