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
不知是什么问题???
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
不知是什么问题???
解决方案 »
- 紧急求助
- picturebox控件Height属性怎样突破最大值
- 在VB中如果没有form,程序的输出怎样处理。
- 送分宏替换问题!!!
- 关于安装程序的制作!
- 这句出错 cnnTmp.CursorLocation = adUseClient,何解?
- 求教:关于DataGrid控件属性的问题,本人20分伺候,先谢过了!!!
- 请问大家如何把一个数据库中的表复制到例外一个数据库中的另外一个表
- ////listbox控件中"重命名“功能是怎样实现的?////
- PIAO616
- VB中如何使用PostMessage移动窗体?
- InitCommonControlsEx 请问这个函数起甚么作用,此函数在comctl32.dll中
jirs.fields.count=?
*****************************************************************************
欢迎使用CSDN论坛阅读器 : CSDN Reader(附全部源代码)
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html