db.Execute "select * from " & Text13.Text & " where 货币 = '" & Combo1.Text & "'"

解决方案 »

  1.   

    错误提示是什么?有可能是SELECT语句语法的问题
    同意楼上的语法格式
      

  2.   

    你的SQL语句格式错了哈。用楼上那个兄弟的。
      

  3.   

    If Val(Text12.Text) <> Val(Text20.Text) + Val(Text21.Text) Then
    MsgBox "输入数据错,请重试!", vbInformation, "警告"
    end if我用文本框显示Val(Text12.Text) 和Val(Text20.Text) + Val(Text21.Text) 都一致,但仍旧显示"输入数据错,请重试!"我觉的是类型不一致,但不知道如何修改,请指教!谢谢!
      

  4.   

    If Val(Text12.Text) <> (Val(Text20.Text) + Val(Text21.Text)) Then
    MsgBox "输入数据错,请重试!", vbInformation, "警告"
    end if
      

  5.   

    If Val(Trim(Text12.Text)) <> Val(Trim(Text20.Text)) + Val(Trim(Text21.Text)) Then
    MsgBox "输入数据错,请重试!", vbInformation, "警告"
    end if
      

  6.   

    db.Execute "select * from " & Text13.Text & " where 货币 = " & Cdec(Combo1.Text)
      

  7.   

    说实话你用的方法太复杂了
    有事电邮我
    [email protected]
      

  8.   

    回复人: crystal_heart(笑看风云) ( ) 信誉:93  2002-12-03 21:20:00  得分:0 
     
     
      If Val(Text12.Text) <> (Val(Text20.Text) + Val(Text21.Text)) Then
    MsgBox "输入数据错,请重试!", vbInformation, "警告"
    end if  
     
    Top 
     
     回复人: chenyu5188(蓝色情调) ( ) 信誉:100  2002-12-03 21:20:00  得分:0 
     
     
      If Val(Trim(Text12.Text)) <> Val(Trim(Text20.Text)) + Val(Trim(Text21.Text)) Then
    MsgBox "输入数据错,请重试!", vbInformation, "警告"
    end if  
     
    还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!还是不对!
      

  9.   

    我靠,   If Val(Trim("100")) <> Val(Trim("60")) + Val(Trim("40")) Then
          MsgBox "输入数据错,请重试!", vbInformation, "警告"
       Else
          MsgBox "ok"
       End If
       If Val("100") <> (Val("60") + Val("40")) Then
          MsgBox "输入数据错,请重试!", vbInformation, "警告"
       Else
          MsgBox "ok"
       End If
      

  10.   

    msgbox text12.text
    msgbox text20.text
    msgbox text21.text
    If Val(Text12.Text) <> (Val(Text20.Text) + Val(Text21.Text)) Then
       MsgBox "输入数据错,请重试!", vbInformation, "警告"
    end if
      

  11.   

    后面那个问题不想说了,就说前面一个问题。"想实现的功能是当text13.text表中有combo1.text这个字段时,则显示已完成"这句话究竟是什么意思,你认为你表达清楚了没有????假设你的text13.text="aaa",combo1.text="bbb"
    你的判断条件究竟是 aaa表中存在名为bbb的字段??????
    还是 aaa表中存在“货币”字段的值为bbb的记录??????简直是一团糨糊再说了,你把错误捕获语句放在可能发生错误
    的语句后面,又怎么能捕获到错误呢???莫名其妙。不废话了,如果你的意思是前者,即“判断某表中是否存在某字段”
    那么可以用以下代码解决:Dim db As Database
    Set db = OpenDatabase(App.Path & "\db1.mdb")On Error GoTo handleError
    db.Execute "select * from " & Text13.Text & " where " & Combo1.Text & " is null"
    MsgBox Combo1.Text & "已完成!", vbInformation, "警告"
    exit subhandleError:
    db.Execute "insert into ......
      

  12.   

    你的意思是:如果记录已经存在,就提示已经完成,否则插入记录。对吧?
    注意:空记录集并不引起错误。Dim db As Database, RS AS RECORDSET
    Set db = OpenDatabase(App.Path & "\db1.mdb")
    SET RS = db.Execute "select * from " & Text13.Text & " where 货币 = " & Combo1.Text
    IF RS.EOF THEN
    db.Execute "insert into ......
    END IF
    MsgBox Combo1.Text & "已完成!", vbInformation, "警告"
      

  13.   

    如果是检查表中[货币]字段是否存在,不存在就插入此字段,如下:
    Dim db As Database
    Set db = OpenDatabase(App.Path & "\db1.mdb")db.Execute "select * from " & Text13.Text & " where 货币 = " & Combo1.Text
    On Error GoTo handleErrorhandleError:
    If Err.Number <> 3265 Then
    MsgBox Combo1.Text & "已完成!", vbInformation, "警告"Elsedb.Execute "ALTER TABLE " & TEXT13.TEXT & " ADD COLUMN " 货币 CURRENCY"
    End If友情提示:数据库的问题请勿要求人家预先调试,人家没有你的库。