Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error not trapped inside TRY/CATCH block
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01050338
Message ID:
01050434
Views:
19
Oh! You are right, apparently it only works for the OPEN FILE dialog, not OPEN DATABASE, and I missunderstood your problem. The hopefully good news is that you can solve the problem, with some extra code :)

Try something like this:


Set the DataEnvironment "AutoOpenTables" property to false and in the Load Event of the form, you can do something like this (very crude, probably not good and incomplete but it might get you some idea until someone gives the proper way to handle it):
set tableprompt off
llError = .f.
with this.DataEnvironment
	for each loCursor in .Objects
		if loCursor.Class == 'Cursor'
			try
				if not Empty(loCursor.Database)
					open database (loCursor.DataBase)
				endif
				use (loCursor.CursorSource) alias test
			catch
				llError = .t.
			finally
				use in Select('Test')
				try
					if not Empty(loCursor.Database)
						set database to (loCursor.Database)
						close databases
					endif
				catch
				endtry
			endtry
			if llError
				return .f.
			endif
		endif
	endfor

	.OpenTables()
endwith
All the try catch statements are to make sure the tables/databases/view can be opened, if all succeed, then you call OpenTables to have all the relationships etc, altough now that I mention it, maybe you just clear the DE and (manually, by code) open everything in the OpenTables method of the dataenvironment
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform