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

Error Loading form

Status
Not open for further replies.

TylerG

Programmer
Jan 5, 2000
16
CA
I have a form that has been acting weird at a clients site. They are running just an executable but for some reason they get an error opening a form from time to time. If I remove a view from the data environment and rebuild the exe and they then open the form from this exe the form opens. I then add the view back in, rebuild and this exe works for the client again. It happens every couple weeks and I don't know why it happens. Any ideas?

TIA,
Tyler
 
What is the exact text of the error message? It should have some information on exactly WHY it can't load the Data Environment and which "record" it crashed on. The record indicated is in the form's structure table. (The *.scx file)

Of course, since you pinpointed the View as being the problem, obviously the record it's crashing on is the one for the View.

In any case, the error message might give us more insight into what could be causing the error.

Ian
 
Error loading file record number 7 form1 or one of its members loadin form or the data environment not a table.
 
Ouch...

That's a tough one. Let's just make sure here.

Let's assume that your form's name is "Myform". If not, substitute the real name. Run the following and tell me what it comes up with:
[tt]
USE MyForm.SCX
GOTO 7
?Properties
USE
[/tt]
Ian
 
Sorry it took so long to reply, I hope you can still help me out

I did that and this is what I got:

Left = 150
Top = 140
Width = 95
Height = 90

Alias = "wkloaddetail"
CursorSource = ..\wkloaddetail.dbf
Name = "Cursor5"

I added this working table to the data environment because the view uses it but I still get the same problem.
 
Since it's a working table, is it deleted and recreated? Does the table exist when you're trying to access it? Has it been created (and still open Exclusively) in a different datasession and not able to be opened again in this DS? Is it corrupted, but rebuilt when you have been removing/adding the view from the project?
 
Ok. That tells you the table that is causing the problems. Now, from the Command Window, see if you can open the table.
[tt]
CD (insert table directory here)
USE wkloaddetail
[/tt]
See if you get any errors there.

It's possible that this table is corrupted at the client site. Is it possible to try this there? You might need to replace the table.

Do you have any problems at all in your development environment?

Ian
 
In the form load I have this code that creates the table:

select loaddetail.* from loaddetail into table wkLoadDetail

index on wkLoadDetail.loadnum + wkLoadDetail.salesnum tag loadsales
=cursorsetprop('buffering',5,'wkloaddetail')

I don't delete it. I just remove the view from the form not the project.
 
That might be your problem. The Data Environment is loaded already before your form LOAD event takes place. Try moving this code to the BeforeOpenTables event of your Data Environment.

Ian
 
Thanks Ian,

I'll try that and I'll get back to you if that is the solution. Have to wait and see if the error comes back up at the clients site.

 
Hi Ian,

That seems to have worked for the Foxpro application with the Foxpro database that I was running, but it has been upgraded to an SQL Server database and I can't have the code in the BeforeOpenTables event of your Data Environment.

The loaddetail is now a remote view. The same error is occuring again.

select loaddetail.* from loaddetail into table wkLoadDetail
index on alltrim(str(wkLoadDetail.loadnum)) + wkLoadDetail.salesnum tag loadsales

Still have that in the load and edit buttons of the form
 
If you look at tools -> options -> file locations, you will see that there are paths where foxpro is looking when it searches for a file or table or etc.

It puts these directories automatically in it. Why??? Do not know. When we cleared it, we get the same sort of error with a table and view we added recently to our database.

But when the directories are filled everything works fine. I wonder of these directories are build in the .EXE. Changing any value then can give problems at the client side.

We used set path in our code to avoid problems with finding any table or view.

 
I have put the set path code into my form now and I'll wait and see if the error occurs still at the client side.

Thank you
 
Still get the error, I removed the working table which is a free table in the database. I have also removed the local view of the working table and the form will open without the error but as soon as I add them back into the data enviornment I get the error. I have just tried it without the working table in the data environment and we'll see what happens
 
No go, I can't get the form to open up with either wkloaddetail or lv_wkloaddetail in the data environment.

Tyler
 
I konw a way that must work but it is not a beautiful solution. Before you try to open say once:

Use MyTable or use the view.

After that open the for. I am sure itt will work but we still don't know what the problem is unfortunately. Try it.
 
Tyler,

In all honesty, you shouldn't even HAVE that table in the data environment since it doesn't actually exist until your SELECT statement executes. In fact, it shouldn't hurt anything at all for it to be taken out. Just remember to close the table in the form's UNLOAD event:
[tt]
IF USED("wkloaddetail")
USE IN wkloaddetail
ENDIF
[/tt]
Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top