Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dealing with Data Environment Cursors
Message
From
02/02/2009 23:45:23
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01378714
Message ID:
01378909
Views:
31
Thanks Naomi!

After reading the Thread #974847 I've made some tests and found that this
problem(mine especifically) could be simply solved by the following method:
1. Set de 'AutoOpenTables' property of 'Dataenvironment' to .F.

2. Adding the following code to the 'Init' method of 'Dataenvironment'
WITH this

	.AddObject('oCursor', 'Cursor')

	.oDataFiles = '<path of database>'

	.oCursor.Database = oDataFiles + '<database name>'
	.oCursor.CursorSource = '<table name>'
	.oCursor.Alias = '<alias>'
	
	.OpenTables
	
ENDWITH
3. I've found that for objects like Grid I have to set columns 'ControlSource' property
from the 'Init' method of the form. If I try to set that at design time I got a runtime error
saying that the 'alias is not found'. The 'RecordSource' property of the Grid can
be set at design time. For objects like TextBox, the 'ControlSource' can be set at
design time.

I didn't done tests with other type of objects.

>Tony,
>
>Check Re: Generic in BeforeOpenTables in Data Environment Thread #974847 Message #975156 and the whole thread.

>
>>Hi.
>>I'm having a small issue with cursors created under form design.
>>
>>For example, when I create a grid in a form and use the Builder
>>to 'format' it, the 'Database' property of the created cursor
>>sets to the fullpath of the database that the table belongs.
>>
>>I change the database to another folder, I set my application to
>>open the tables/database to the new folder but when I open that
>>form in the application I got an error message titled 'Locate Database'
>>saying 'Error Instantiating cursor object. bla bla bla'.
>>How can I avoid this?
***
TONY Nascimento
*****************

"Your mind is like a parachute. It only works if it is open" - Anthony J. D'Angelo

"The desire to know is natural to good men" - Leonardo da Vinci
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform