Office中国论坛/Access中国论坛

标题: 代码求助,请高手帮忙,谢谢! [打印本页]

作者: bjyutong    时间: 2009-10-16 16:39
标题: 代码求助,请高手帮忙,谢谢!
本帖最后由 bjyutong 于 2009-10-16 16:47 编辑

Private Sub Command7_Click()
On Error GoTo Err_Command7_Click
Dim zy As String
    zy = "
UPDATE 准备 SET 准备.备注 = iif(准备.本金=0,"补偿金","退款")
WHERE 准备.备注 is null;"
DoCmd.RunSQL zy
Exit_Command7_Click:
    Exit Sub
Err_Command7_Click:
    MsgBox Err.Description
    Resume Exit_Command7_Click
作者: bjyutong    时间: 2009-10-16 17:11
通过一个笨方法解决了,希望大能有好的解决方法提供给我,谢谢!

Private Sub Command7_Click()
On Error GoTo Err_Command7_Click
    Dim gx As String
    Dim gx2 As String
   
    gx = "update 准备 set 准备.备注 = '补偿金' where 准备.本金=0 and 准备.备注 is null;"
    gx2 = "update 准备 set 准备.备注 = '退款' where 准备.本金<>0 and 准备.备注 is null;"
   
    DoCmd.RunSQL gx
    DoCmd.RunSQL gx2
   Exit_Command7_Click:
    Exit Sub
Err_Command7_Click:
    MsgBox Err.Description
    Resume Exit_Command7_Click
   
End Sub
作者: rjacky    时间: 2009-10-16 17:26
你原来的代码并没有什么问题呀,和你2楼的效果是一样的
作者: bjyutong    时间: 2009-10-16 18:06
3# rjacky

谢谢版主!




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3