*: Function: UseExclusive *: David Fluker, October 2001 *: *: Description: Uses a file exclusively, returns .F. if failed *: *: Syntax: =UseExclusive(cUseStatement) *: *: Parameters: lcUseStatement - The use statement *:****************************************************** lparameter lcUseStatement LOCAL llRetVal, llAttemptUse, lcCurrentOnError llRetVal = .T. && Return Value llAttemptUse = .T. && Don't attempt USE statement if .F. lcCurrentOnError = '' && Value of current ON("ERROR") *: Prepare and check use statement passed in as parameter *: If a check fails, set llAttemptUse to .F. IF VARTYPE(lcUseStatement) != 'C' lcUseStatement = '' ENDIF IF NOT (' USE ' $ ' ' + UPPER(lcUseStatement)) llAttemptUse = .F. ENDIF *: *: Add any additional checks here. *: *: Make it EXCLUSIVE is it's not already IF NOT ('EXCL' $ UPPER(lcUseStatement)) lcUseStatement = lcUseStatement + ' EXCLUSIVE ' ENDIF *: Attempt the USE statement IF llAttemptUse = .T. lcCurrentOnError = ON('ERROR') ON ERROR llRetVal = .F. &lcUseStatement ON ERROR &lcCurrentOnError ELSE llRetVal = .F. ENDIF RETURN llRetVal>Hi.