>I have create student.dbf having fileds with 1.GE 2. MBC 3.SC 4.YA 5.KA and entered the values for GE =20, MBC =15 SC=10 YA =5 KA 7.
>all the fields are Integer type, and I have designed student.scx in that I have placed five text boxes namely 1.txtge 2.txtmbc 3.txtsc 4.txtya 5.txtka and one combo box and one command button. In initialisation event i have written code belwo
>use student
>thisform.txtge.value = GE
>thisform.txtmbc.value = MBC
>thisform.txtsc.value = SC
>thisform.txtya.value = YA
>thisform.txtKA.value = ka
>
>thisform.combo1.additem("GE")
>thisform.combo1.additem("MBC")
>thisform.combo1.additem("SC")
>thisform.combo1.additem("YA")
>thisform.combo1.additem("KA")
>
>I want two types of code
>1. I have selelct combo1.value = "GE" or "MBC" or "SC" then go to the GE field first and subtract the value -1, if GE fields value = 0 then if combo1.value = "MBC" then go to the MBC field and subtract the value -1 else, if combo1.value = "SC" then go to the SC field and subtract the value -1.
>
>2. But i have select combo1.value = "YA" " then first go to the YA field and subtract the value -1 else if I have select combo1.value = "KA" then go to the "KA" field and subtract the value -1. if 'YA" and "KA" fields value = 0 then go the "GE" fields , if "GE" field value = 0 then Message box there is no value.
>
>can anyone give the solution How to write code?
>
>Thanking you
DO CASE
CASE thisform.combo1.ListIndex < 4 AND TableName.Ge # 0
REPLACE Ge WITH Ge - 1 IN TableName
CASE thisform.combo1.ListIndex == 2
REPLACE MBC WITH MBC - 1 IN TableName
CASE thisform.combo1.ListIndex == 3
REPLACE Sc WITH Sc - 1 IN TableName
CASE TableName.Ka == 0 AND TableName.Ya == 0 AND TableName.Ge == 0
MessageBox([There is NO value])
CASE TableName.Ka == 0 AND TableName.Ya == 0
REPLACE Ge WITH Ge - 1 IN TableName
CASE TableName.Ya # 0 AND thisform.combo1.ListIndex == 4
REPLACE Ya WITH Ya - 1 IN TableName
CASE TableName.Ka # 0 AND thisform.combo1.ListIndex == 5
REPLACE Ka WITH Ka - 1 IN TableName
OTHERWSIE
MessageBox([What should we do here?])
ENDCASE
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.