Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"File must be opened exclusively" error 2

Status
Not open for further replies.

abbyanu

IS-IT--Management
Jan 18, 2001
82
0
0
US
Hi

I'm trying to delete a record then PACK, while working on a data entry form, but I'm getting the above error. I have tried both the SET EXCLUSIVE OFF and SET EXCLUSIVE ON commands before the PACK command but the error persists.

Any idea how I can work around this? I'm also using the GETCURSORPROP command, and I wonder how to turn it off, if this could be the cause of the problem. Thank you.
 
If your initial state is SET EXCLUSIVE OFF when you open the table, issuing SET EXCLUSIVE ON does not give you exclusive use of the file, which is required for the PACK command.

After issuing the SET EXCLUSIVE OFF you could SELECT the target table, issue a USE DBF() EXCLUSIVE command and then PACK would work(if it isn't open in another work area). But before you do that you need to address any multi-user(network) issues you may have. --Zog
 
Thanks Zog. That worked like kudzu!!

But I'm now faced with an additional problem with the grid. When I delete the record and then refresh, the grid appears blank. Any way of ensuring that the grid is up-to-date with the table when you delete and pack records?
 
Hello.

Before the PACK command, programatically remove the recordsource property:

ThisForm.Grid.RecordSource=""

Then issue the PACK command. After that, restore the recordsource, as follows:

ThisForm.Grid.RecordSource="MyTable" && or anything else...

Hope this helps.
Grigore Dolghin
 
This too worked like kudzu! Many thanks!!
 
PS. Many thanks to Grigore and Zog for your kind assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top