0

i am a beginner in learning VFP and i am facing a problem.

I have two forms:

  • a login form with user and password to be completed. theese values are searched in a table from database.
  • another form containing a grid with dates from the users table. i use this for changing the password for selected user in the grid.

The problem is i can not populate the grid with data from the table "users", because i keep reciving the error "File in use". i set the RecordSource for data to table, sql statement and alias and still nothing. i have tried replacing the grid with list and combobox, but i still receive the error.

Please help ! :) Thank you

3 Answers3

1

In your application, there is a "SET EXCLUSIVE" setting, so if anyone else has the file open, it will prevent you from getting at it. So somewhere in the beginning of your app.

SET EXCLUSIVE OFF

This will allow the table to be opened multiple times and by multiple users in network environments. Additionally, if you would like, I have offered many in the past of mentoring / guidance in VFP development where it can be more detailed that snippets such as this forum.

DRapp
  • 47,638
  • 12
  • 72
  • 142
0

In addition to DRapp's answer, you can also get a "File in use" error if you're trying to open a table (that's already open) in another work area.

You can use

USE users AGAIN 

to avoid that, or

SELECT users

if you only want the DBF to be opened once.

(of course, use your own DBF name and alias in the examples)

LAK
  • 961
  • 7
  • 18
0

As @DRapp pointed out SET EXCLUSIVE OFF should resolve your issue, but sometimes you may need to access a table exclusively. To do that you can type the following:

USE tablename EXCLUSIVE

But remember that while a table is exclusively used, you will not be able to use it anywhere else in the application unless you use the same instance.