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!

Cannot update cursor

Status
Not open for further replies.

joerocket

Programmer
Nov 22, 2000
35
US
This is my first attempt at a multiple document interface application, using VFP 5.0a. The app starts up, runs the menus and forms called by the main.prg and allows record navigation. The problem occurs when selecting any form field with the mouse I get a "Cannot update cursor" error.

What am I missing?
 
Hmm, if you can describe more you form, I will ask you following:
1. Which controls you use at form at all and how they bound to data? Are you sure that required cursor opened in current data session (for for controls that use that cursor fields as control source)?
2. Do you use combobox/listbox controls with SQL, alias or table row source?
3. Are yuo sure the cursor used for work is not read-only? Is it buffered/updatable view?



Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Vlad / Robert

Here is the layout:
Main form (set as "2- top level" in the Show Window Property)with no Data Environment defined.
Three other forms that open within the top level form, each with its own Data Environment.

In answer to your inquiries:
1)Each form consists of 4 or 5 text boxes and a child grid. The forms use "Select" to choose the cursor when activated, but I am not sure (can I be?) that the required cursor opened in the current data session.

2)No combobox/listbox controls used.

3)Cursor's properties for read only are set for .F.

4)Yes private data sessions are being used, but I have tried it both ways.

thanks guys,

Jacob Smith
 
but I am not sure (can I be?) that the required cursor opened in the current data session

1. The problem might be in the cursor not visible to controls. This might occur because something closed that cursor, or cursor gone out of visibility because private data sessions.

2. The problem might be in grid, if it uses SELECT statement, sometimes it locks records/cursor and accessing that cursor or any other command that tries to work with it; this might cause internal VFP errors like that (this applies to comboboxes and listboxes too). The best and the most reliable way for gris is to use cursor, not SELECT statement.

3. Check also your code. Are you sure this error not caused by line of code?

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Vlad,

My ignorance is obvious at this point, but here goes anyway...

In the properties of the Data Environment, each cursor has a Name and an Alias. I am using SELECT cTableAlias for the form on the INIT event of the form. Is this not using the cursor? Is there a better way?

Thanks,

Jacob Smith

 
Hmm, If you feel that you don't know something, go to programmers guide and read it ;-)
Ok, sorry.
SELECT cTableAlias command just selects alias (table or cursor opened in some work area) as current. Current alias means that commands

Select MyAlias
replace MyField with MyValue in MyAlias

will not require 'in MyAlias' part, just because MyAlias is current.

However, there are many tools in VFP, and there are many commands (that you might use somewhere in form) that change current alias. So, when you writing a program in VFP, always keep eye on such thing to do not make wrong suggestions that require alias for work is already current.
Example (and this might be a real cause of your problem):
You use select MyAlias in INIT method of form. Than, suggesting that this alias is always current, you use 'MyField1', 'MyField2', ... in the ControlSource property of your controls. However, when MyAlias is not current, these fields will not be visible for controls, just because another alias does not contain these fields. To solve this problem, I recommend you always use alias before field in ControlSource property:
'MyAlias.MyField1', 'MyAlias.MyField2', ...

Hope this helped. Send answer here if that was a cause of problem.



Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Vlad,

I appreciate the time and effort of your responses.

Thanks to your comments I have re-read several chapters of the Developers Guide and now feel confident that the source of trouble is with the MDI setup, and not the cursor itself.

It's not resolution, but less confusion is progress.

Jacob Smith
 
Just for the record...

Vlad was on the right track with his original thought that it was related to the Read Only property of the cursor.

It turns out that the table was set for "Include" in the project manager. According to the help documentation, "All included files are compiled into the .APP or .EXE file, making them read-only." So if a user attempts to access a control sourced from one of these included tables the executable gives a "Cannot update the cursor" error and shuts down the program.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top