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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table Problem

Status
Not open for further replies.

Maxlore

IS-IT--Management
Mar 9, 2011
12
US
I know this should be a simple problem to fix but it eludes me..
In my dbc all my tables are there and relations are set..np..
In my form the data environment has the tables in it also..np..
Problem is every time I try to cycle through the records with SKIP 1 or anything the vfp "Tables in database" window opens wanting me to open one of the tables thats in in the dbc..I have looked in the data session window and the tables are open and the relations are set,,at least as far as i can see. If I select any of the tables in the "Tables in database" window i get "File in Use" ERROR

The following is what i have cut out of the main prg that relates to this problem .. i think :)

CLOSE DATABASES
SET COMPATIBLE ON
SET CENTURY ON
SET MULTILOCKS ON
SET EXCLUSIVE ON

OPEN DATABASE ('path\filename')

SELECT 0
USE file1
SET ORDER TO file1idx Ascending
= CURSORSETPROP('Buffering',3,'file1')

SELECT 0
USE file2
SET ORDER TO file2idx Ascending
= CURSORSETPROP('Buffering',3,'file2')
"I do this for all the tables in the dbc"


DO FORM formname

This is what i placed into the "Next" nav button for next record

SELECT (THIS.parent.nWorkArea)

IF !EOF()
SKIP 1
ENDIF

THIS.Parent.EndFile = EOF()
THIS.Parent.TopFile = BOF()
THISFORM.rFreshList1()
THIS.Parent.NavRefresh()

In debug it dies at the SKIP 1 line

I do not know if this is the best way to do this,,i have been out sick for a long time and trying to get back into it..Hope someone can help,,and if I am doing anything wrong please tell me.. Any suggestions will be appreciated .
 
Sounds like your form is using a private data session and you haven't added the needed tables to the data environment. Of course, you also have SET EXCLUSIVE ON which means you *can't* do that.

Either set your forms to use the default data session or SET EXCLUSIVE OFF and properly set up each form's private data session.
 
Maxlore,

The reason you are seeing the tables in the data session window is probably that you are only looking at the default data session.

If you open the drop-down at the top of the data session window, you will be able to switch to the data session for the form. That will tell you if the tables really are open in the form. (Presumably, they are not, for the reason Dan mentioned.)

To open the tables in the form's data session, either add them to the data environment, or simply USE them in the form's Load event (not the Init).

By the way, there is another small problem. In your Next button, you have this code:

IF !EOF()
SKIP 1
ENDIF

This won't prevent you navigating to the EOF, in which case you will just see a blank record. This might not matter, but you can easily avoid it by using this code instead:

SKIP
IF EOF()
SKIP -1
ENDIF

Hope this helps.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
To open the tables in the form's data session, either add them to the data environment, or simply USE them in the form's Load event (not the Init).

Which won't work at all as long as SET EXCLUSIVE ON is in the setup code, as posted.

There isn't a "change this one thing" fix here. :-(
 
Thanks you guys very much...I'm getting the hang of it again...and
just started using vfp 9...but thanks very much guys
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top