我的这个代码怎么需要点击两下按钮才能全部执行呢?
我写的这个代码想先修改数据表,然后在利用数据表的数值进行再次计算,并将结果更新在数据表内?为什么要点击两下按钮才可以呢?按钮的click代码:
点击第一下,执行了前面的数据修改保存代码,修改了数据,在点击第二下,执行以后的代码,对数据重新计算并更新在了数据表内.
peidianxiang.rar
(161.43 KB)
程序代码:
*-------------------------------------------以下代码用于修改后保存更新取费-------------------------------------------- Sele cundao Replace 项目名称 With Thisform.container1.Txt项目名称.Value Replace 配电柜编号 With Thisform.container1.TXT配电柜编号.Value Replace 产品名称 With Thisform.container1.TXT产品名称.Value Replace 规格型号 With Thisform.container1.TXT规格型号.Value Replace 数量 With Thisform.container1.TXT数量.Value Replace 单位 With Thisform.container1.TXT单位.Value Replace 单价 With Thisform.container1.TXT单价.Value Replace 合计 With Thisform.container1.TXT合计.Value Thisform.grid1.SetFocus Thisform.text59.Value=Thisform.container1.Txt项目名称.Value&&用于修改后数据的搜索 Thisform.text60.Value=Thisform.container1.TXT配电柜编号.Value&&用于修改后数据的搜索 Set Talk Off &&关闭计算显示,防止在界面上显示结算结果 Select cundao aa=Thisform.text59.Value bb=Thisform.text60.Value cc=Thisform.text54.Value Sum 合计 For 配电柜编号=Alltrim(Thisform.text60.Value) And 项目名称=Alltrim(Thisform.text59.Value) And 单位="只" To Thisform.text54.Value Thisform.Refresh Sele cundao Replace 单价 With cc*Thisform.text3.Value For cundao.配电柜编号=bb And cundao.产品名称=Thisform.check12.Caption And cundao.项目名称=aa Replace 合计 With cc*Thisform.text3.Value For cundao.配电柜编号=bb And cundao.产品名称=Thisform.check12.Caption And cundao.项目名称=aa Replace 单价 With cc*Thisform.text50.Value For cundao.配电柜编号=bb And cundao.产品名称=Thisform.check13.Caption And cundao.项目名称=aa Replace 合计 With cc*Thisform.text50.Value For cundao.配电柜编号=bb And cundao.产品名称=Thisform.check13.Caption And cundao.项目名称=aa Replace 单价 With cc*Thisform.text51.Value For cundao.配电柜编号=bb And cundao.产品名称=Thisform.check14.Caption And cundao.项目名称=aa Replace 合计 With cc*Thisform.text51.Value For cundao.配电柜编号=bb And cundao.产品名称=Thisform.check14.Caption And cundao.项目名称=aa Replace 单价 With cc*Thisform.text52.Value For cundao.配电柜编号=bb And cundao.产品名称=Thisform.check15.Caption And cundao.项目名称=aa Replace 合计 With cc*Thisform.text52.Value For cundao.配电柜编号=bb And cundao.产品名称=Thisform.check15.Caption And cundao.项目名称=aa Replace 单价 With cc*Thisform.text53.Value For cundao.配电柜编号=bb And cundao.产品名称=Thisform.check16.Caption And cundao.项目名称=aa Replace 合计 With cc*Thisform.text53.Value For cundao.配电柜编号=bb And cundao.产品名称=Thisform.check16.Caption And cundao.项目名称=aa Thisform.Refresh Thisform.grid1.Refresh *-------------------------------------------以下代码用于修改后保存更改小计的费用-------------------------------------------- Select cundao Sum 合计 For 配电柜编号=Alltrim(Thisform.text60.Value) And 项目名称=Alltrim(Thisform.text59.Value) And 数量>0 To Thisform.text58.Value Thisform.Refresh Sele cundao Replace 合计 With Thisform.text58.Value For cundao.配电柜编号=Alltrim(Thisform.text60.Value) And cundao.产品名称="小计" And 项目名称=Alltrim(Thisform.text59.Value) *Go Recno() Thisform.grid1.Refresh Thisform.grid1.SetFocus
[此贴子已经被作者于2020-3-2 13:36编辑过]