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

Delete does not mark the record for deletion. 3

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
I am using a form with a <Delete> command button with the following code in cmdDelete's Click Event:

iResponse = MESSAGEBOX(&quot;Are You Sure You Want To Delete This Record ?&quot;,36,&quot;Warning:&quot;)
*
IF iResponse = 7 then
* Answered No
RETURN
ELSE
* Answered Yes: iResonse = 6
DELETE Next 1
TABLEUPDATE(0)
THISFORM.RELEASE
ENDIF


With or without the TABLEUPDATE(0) statement included, the record on my form is not being marked for deletion in the table.

I'm using optimistic row buffering on the table in my dataenvironment. The form's text boxes have control sources which are linked directly to the fields.

Why doesn't the record get marked for deletion?
The 2nd mouse gets the cheese.
 
hi

first, i suggest you check the status of your SET DELETED... it should be ON

also try ignoring the TABLEUPDATE() and see what happens.

let me know if you get through.

peace,
abbyanu.
 
Set Deleted was ON and removing the tableupdate(0) command has no effect either. Any other ideas?
The 2nd mouse gets the cheese.
 
drosenkranz

Try:-

lnAnswer = MESSAGEBOX([Are You Sure You Want To Delete This Record ?],;
[tab]0 + 36 + 0,;
[tab][Warning:])

IF lnAnswer = 6
DELETE Next 1 IN TABLENAME
TABLEUPDATE(.T.,.T.,[TABLENAME])
THISFORM.RELEASE
ENDIF

Chris
 
drosenkranz

Error in last post and the value in red is illegal, maybe a typo?

lnAnswer = MESSAGEBOX([Are You Sure You Want To Delete This Record ?],;
0 + 36 + 0,;
[Warning:])

should be

lnAnswer = MESSAGEBOX([Are You Sure You Want To Delete This Record ?],;
4 + 32 + 0,;
[Warning:])

Chris
 
Is the table in which you make your deletion the currently selected table. If not, is the currently selected table on EOF ?? If so, deletion on your table in which you make the deletion won't work.

HTH,
Weedz (Wietze Veld)
veld4663@exact.nl

They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best.

After the GoldRush - Steve McConnell
 
Hi!

Hmm, looks like another problem related to the form's activate event. Messagebox is such a kind of thing that causes firing of some events after and before return to the main algorithm. For example, Valid event of control will be fired. These event might contain code that change either data session, current alias or current record.

As about SET DELETED, it does nothing to DELETE or RECALL commands, it just affects the way how data are displayed/filtered from deleted records.

You will require tableupdate() only to save buffered data. DELETE command marks record for deletion in buffered table and until reverted or recalled this record appears on the form as deleted and filtered out from alias cursor when SET DELETED ON. So this command makes no difference here too.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Thanks for all of the input everyone- lots of good info to work from here. I appreciate your time.
The 2nd mouse gets the cheese.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top