Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor cannot be modified because it contains an unsaved
Message
From
05/03/2014 22:21:15
 
 
To
05/03/2014 14:45:12
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01595802
Message ID:
01595857
Views:
79
>From VFP help:
>
>This error typically occurs when a record in a cursor is modified in a grid or Browse window and is not saved before moving to another record.
>
>Any code that modifies the cursor should ensure that all modifications are saved before moving the record pointer.

>
>I believe this means that if you use buffering, you should use a TableUpdate() to commit any changes, such as REPLACE or DELETE.
>
>
>>Dear Sir,
>>
>>Form INIT event has these codes
>>
>>SET DELETED ON
>>
>>PUBLIC this_user, this_cate
>>STORE 0 TO this_user, this_cate
>>thisform.cates=""
>>this_user=1
>>
>>
>>Combobox.click event has these codes
>>
>>
>>thisform.grid1.recordsource=""
>>thisform.cates=int(val(thisform.combo1.value))
>>
>>select stock
>>locate for usno=m.this_user and cate=thisform.cates and usno>0 and nos>0
>>
>>if not found()
>>	append blank
>>	replace usno with m.this_user
>>	replace cate with thisform.cates
>>	replace nos with 1
>>endif
>>
>>set filter to usno=m.this_user and cate=thisform.cates and usno>0 and nos>0
>>locate
>>
>>thisform.grid1.recordsource="stock"
>>thisform.grid1.column1.controlsource="stock.pno"
>>thisform.grid1.column2.controlsource="stock.nos"
>>
>>*thisform.grid1.refresh
>>
>>thisform.fill_grid()
>>
>>
>>and then Grid1.BeforeRowColChange has these codes
>>
>>
>>SELECT stock
>>replace cate WITH thisform.cates
>>replace usno WITH m.this_user
>>
>>
>>If This.RowColChange = 1
>>	If stock.nos=0
>>		This.AllowAddNew = .F.
>>	Else
>>		This.AllowAddNew = .T.
>>	Endif
>>Endif
>>
>>*thisform.grid1.Refresh
>>
>>thisform.fill_grid()
>>
>>
>>When I try to save or edit records from grid then on this line
>>
>>
>>replace cate WITH thisform.cates
>>
>>
>>It shows this error message
>>
>>Cursor cannot be modified because it contains an unsaved record (Error 2072)
>>
>>Please help me to overcome this problem
>pre




Sir

I replaced this line
replace cate WITH thisform.cates

with
replace cate WITH thisform.cates IN stock

Now everything is ok, no error occurs.

I do not use any type of buffering. All is default.

Thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform