添加按钮将在相同的细节时触发

时间:2017-03-30 01:50:17

标签: visual-foxpro

SELECT series   
APPEND BLANK
    Replace doc_num WITH thisform.pageframe1.page1.docnum.value
    Replace doc_type WITH thisform.pageframe1.page1.doctype.value
    Replace doc_title WITH thisform.pageframe1.page1.doctitle.value
    Replace doc_date WITH thisform.pageframe1.page1.docdate.value
    Replace rec_date WITH thisform.pageframe1.page1.recdate.value
    Replace pub_date WITH thisform.pageframe1.page1.pubdate.value
    Replace sector WITH thisform.pageframe1.page1.sector.value
    Replace cluster WITH thisform.pageframe1.page1.cluster.value
    Replace reg_office WITH thisform.pageframe1.page1.region.value
    Replace revision WITH thisform.pageframe1.page1.revision.value
    Replace processedby WITH thisform.pageframe1.page1.procby.value
    Replace reviewedby WITH thisform.pageframe1.page1.revby.value
    Replace encodedby WITH thisform.pageframe1.page1.encby.value
            MESSAGEBOX("New record successfully saved...",0+64,"Success")

这是我的添加按钮中的代码,你能帮助我下一步当我添加相同的信息时它会触发详细信息已经保存。谢谢。

1 个答案:

答案 0 :(得分:0)

根据Cetin Basoz,命令应为

INSERT INTO series ( doc_num, doc_type, doc_title, doc_date, ;
rec_date, pub_date, sector, cluster, reg_office, revision, processedby, ;
reviewedby, encodedby) VALUES ;
(thisform.pageframe1.page1.docnum.value, ;
thisform.pageframe1.page1.doctype.value
thisform.pageframe1.page1.doctitle.value, ;
thisform.pageframe1.page1.docdate.value, ;
thisform.pageframe1.page1.recdate.value, ;
thisform.pageframe1.page1.pubdate.value, ;
thisform.pageframe1.page1.sector.value, ;
thisform.pageframe1.page1.cluster.value, ;
thisform.pageframe1.page1.region.value, ;
thisform.pageframe1.page1.revision.value, ;
thisform.pageframe1.page1.procby.value, ;
thisform.pageframe1.page1.revby.value, ;
thisform.pageframe1.page1.encby.value)
MESSAGEBOX("New record successfully saved...",0+64,"Success")

如果表系列不可用并连接到数据库,则可以设置主键。如果没有,那么你可以使用像

这样的命令
select series
locate for doc_num = thisform.pageframe1.page1.docnum.value or ;
doc_type = thisform.pageframe1.page1.doctype.value or ; ...... and so on
if found()
*here what to do if data found in table
endif