Private Sub cmd_save_Click()
On Error Resume Next
    If IsNull(Trim(txt_amount.Text)) = False Then
        rs.Open "select * from LastCost", conn, 2, 3
        rs.AddNew
        rs.Fields("month") = CInt(cmb_month.ListIndex + 1)
        rs.Fields("cdept") = cmb_cdept.Text
        rs.Fields("amount") = txt_amount.Text
        rs.Update
        temp = rs.Fields("amount")
        rs.Close
    Else
        MsgBox "请检查,金额不能为空。"
        Exit Sub
    End If
    If Trim(cmb_cdept.Text) = "经营部" Then
        rc.Open "select ZongF,ChaiF,GongZ,YeW,SheJ,BanG,YunF,BaoZ,last from cost where month=" & (cmb_month.ListIndex + 1), conn, 2, 3
        
        rc.Fields("ZongF") = temp
        jirs.Open "select * from lu", conn, 2, 3
        For x = 3 To 9
            rc.Fields.Item(x) = CCur(temp * jirs.Fields.Item(x - 2))
            
        Next x
        rc.Fields("last") = True
        rc.Update
       
        jirs.Close
        rc.Close
       ' Set rc = Nothing
       ' Set jirs = Nothing
    End If
        
    
        MsgBox "保存成功!"
        cmd_add.Enabled = True
If Err.Number <> 0 Then
    MsgBox Err.Description
End If
End Sub
运行以上程序,总提示:
Item cannot be found in the collection corresponding to the requested name or ordinal
不知是什么问题???