I have this code to update a record, but some times when i do updating its changes all in the database with the same record... so all records in the database have the same idnumber names surnames and other fields.... please help.... thanks and God bless...
PROCEDURE CmdUpdate.Click()
idpointer = this.Parent.cboidnum.value
IDNAMBER = this.parent.text1.value
neym = this.parent.text2.value
sneym = THIS.parent.TEXT3.VALUE
mobyle = this.Parent.text4.value
advyser = this.Parent.text7.value
eaddress = this.Parent.text8.value
especial = this.Parent.CboSpecial.value
sexx = this.Parent.CboSex.value
ctrr = 0
estatus = this.Parent.cbostatus.value
aay = ALLTRIM(STR(YEAR(DATE())))
ddatedit = DATETIME()
ggrade = "F"
mmode = "B"
*estatus = "Enrolled"
graded = this.Parent.text5.value
moded = this.Parent.cboMode.value
SELECT tsulat
IF FLOCK()
UPDATE TSULAT SET idnum = idnamber, fname = neym, sname = sneym, mobile = mobyle, adviser = advyser, eadd = eaddress, special = especial, ;
sex = sexx, ctr = 0, status = estatus, ay = aay, datedit = ddatedit WHERE idnum = idpointer
IF this.Parent.text9.value = 1
UPDATE tsulat SET grade = ggrade, mode = mmode, status = estatus WHERE idnum = idpointer
ELSE
UPDATE tsulat SET grade = graded, mode = moded WHERE idnum = idpointer
ENDIF
UNLOCK IN TSULAT
ELSE
WAIT WINDOW 'Unable to open MAIN Table; try again later!' NOWAIT
ENDIF
SELECT idnum, ALLTRIM(sname) + ", " + ALLTRIM(fname) FROM tsulat ORDER BY sname, fname INTO CURSOR csrdemo READWRITE
This.Parent.text1.value = " "
This.Parent.text2.value = " "
this.Parent.text3.value = " "
this.Parent.text4.value = " "
This.Parent.text5.value = " "
This.Parent.text7.value = " "
This.Parent.text8.value = " "
This.Parent.cboMode.value = " "
this.Parent.CboIdnum.value = " "
this.Parent.Cbospecial.value = " "
this.Parent.cbostatus.value = " "
this.Parent.cboSex.value = " "
This.Parent.text16.value = " "
ENDPROC
PROCEDURE CmdUpdate.Click()
idpointer = this.Parent.cboidnum.value
IDNAMBER = this.parent.text1.value
neym = this.parent.text2.value
sneym = THIS.parent.TEXT3.VALUE
mobyle = this.Parent.text4.value
advyser = this.Parent.text7.value
eaddress = this.Parent.text8.value
especial = this.Parent.CboSpecial.value
sexx = this.Parent.CboSex.value
ctrr = 0
estatus = this.Parent.cbostatus.value
aay = ALLTRIM(STR(YEAR(DATE())))
ddatedit = DATETIME()
ggrade = "F"
mmode = "B"
*estatus = "Enrolled"
graded = this.Parent.text5.value
moded = this.Parent.cboMode.value
SELECT tsulat
IF FLOCK()
UPDATE TSULAT SET idnum = idnamber, fname = neym, sname = sneym, mobile = mobyle, adviser = advyser, eadd = eaddress, special = especial, ;
sex = sexx, ctr = 0, status = estatus, ay = aay, datedit = ddatedit WHERE idnum = idpointer
IF this.Parent.text9.value = 1
UPDATE tsulat SET grade = ggrade, mode = mmode, status = estatus WHERE idnum = idpointer
ELSE
UPDATE tsulat SET grade = graded, mode = moded WHERE idnum = idpointer
ENDIF
UNLOCK IN TSULAT
ELSE
WAIT WINDOW 'Unable to open MAIN Table; try again later!' NOWAIT
ENDIF
SELECT idnum, ALLTRIM(sname) + ", " + ALLTRIM(fname) FROM tsulat ORDER BY sname, fname INTO CURSOR csrdemo READWRITE
This.Parent.text1.value = " "
This.Parent.text2.value = " "
this.Parent.text3.value = " "
this.Parent.text4.value = " "
This.Parent.text5.value = " "
This.Parent.text7.value = " "
This.Parent.text8.value = " "
This.Parent.cboMode.value = " "
this.Parent.CboIdnum.value = " "
this.Parent.Cbospecial.value = " "
this.Parent.cbostatus.value = " "
this.Parent.cboSex.value = " "
This.Parent.text16.value = " "
ENDPROC