Hi Dennis,
Are you getting any error messages?
Try to run the functions through the debugger (SET STEP ON) to see the result after each line of code.
>I have a problem in update the delete/insert record(s) into the table after close the windows/or through a exit button.
>Is this any coding error in this two INSERT and DELETE functions.
>Please help me to solve problem a.s.a.p.
>
>The following is the coding of the INSERT FUNCTION
>
>SELECT ODETAIL
>lcOldTalk = SET("TALK")
>SET TALK OFF
>lcOldDeleted = SET("DELETED")
>SET DELETED OFF
>** Insert new record
>APPEND BLANK
>REPLACE odetail.orderno WITH Order.OrderNo IN odetail
>*REPLACE order_id with lMaxID in orders
>** Restore talk setting
>SET TALK &lcOldTalk
>SET DELETED &lcOldDeleted
>SELECT ORDER
>THISFORM.Refresh
>
>**end of INSERT FUNCTION
>
>The following is the coding of the DELETE FUNCTION
>
>#DEFINE MSGBOX_YES 6
>#DEFINE C_MSGBOX1 36
>#DEFINE C_DELETE1_LOC "Are you sure you want to delete the order number "
>#DEFINE C_DELETE2_LOC "?"
>** Note that there is no RI procedures built-in to the testdata database
>** so that there will be orphan records left in the orditems table after
>** deleting the records from the Customer and Orders table.
>lcMessage = C_DELETE1_LOC + ALLTRIM(ODetail.OrderNo) +ALLTRIM(ODetail.StockNo)+ C_DELETE2_LOC
>lcOrderID = Order.OrderNo
>IF MESSAGEBOX(lcMessage,C_MSGBOX1) = MSGBOX_YES
> SELECT ODETAIL
> DELETE
> IF !EOF()
> SKIP 1
> ENDIF
> IF EOF() AND !BOF()
> SKIP -1
> ENDIF
> THISFORM.Refresh
>ENDIF
>
>**END OF DELETE FUNCTION
>
>Waiting for any advice.
>Many thanks for any assistance.
>
>Dennis
Benn Kjaer
MS Certified Professional - Visual Foxpro
"There is something rotten in the state of Denmark"
"Why make user-friendly programs, when there aren’t any friendly users :o)"